This function compares phylogenies to identify topological similarities. Let’s start by loading required libraries, and then visualize a set of example phylogenies.
library(ape)
library(phytools)
library(dplyr)
phy.set <- readRDS("phy.list.RDS")
par(mfrow=c(1,3))
plot(phy.set[[1]], cex=2)
plot(phy.set[[2]], cex=2)
plot(phy.set[[3]], cex=2)We want to compare how the topology of the phylogenies on the center and right compare against the topology on the left. This function always assumes that the target topology of interest is the first entry in the list of trees. The function itself only takes a few arguments:
phy.list: AlistormultiPhylocontaining the phylogenies of interestpie.cols: Acharactervector the same length as the number of phylogenies being compared against the target phylogeny (in this example n = 2)cex:numericvectorlength1 corresponding to the size of the pies being plotted...: Optional arguments to be passed toplot.phylo
Let’s load the function, and define our parameters for plotting
Now we can visualize the plot, and add a legend.
par(mai = c(.5,.1,.1,.1))
plot.shared.nodes(phy.set, pie.cols, cex)
axisPhylo()
legend(x = 0,
y = 1.75,
legend = c("Present in comparison 1",
"Present in comparison 2"),
fill = pie.cols, border = "black",
cex = .8)