Using cophyloplot in R to plot mirror trees with as many horizontal lines as possible

I use cophyloplot

in package ape

c R

to make two phylogenetic trees face-to-face with links (trees are rooted at tip 1).

library(ape)
set.seed(1)
tree1 <-read.nexus("tree1.nex", tree.names = NULL)
tree2 <-read.nexus("tree2.nex", tree.names = NULL)
tree1$tip.label<-(1:28)
tree2$tip.label<-(1:28)
a <- c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28)
b <- c(1,15,3,4,6,5,23,26,28,27,16,14,22,18,19,10,9,8,7,11,25,24,2,21,12,13,17,20) 
association <- cbind(a, b)
cophyloplot(tree1, tree2, assoc = association, length.line = 4, space = 30, gap = 3,col="red", show.tip.label=FALSE) 

      

If I rotate some of the nodes, one tree can be manipulated so that more links are displayed horizontally / straight ahead (i.e. trees are more reflective).

Is there a way to automatically build referenced trees so that they are best fit / mirror / each other by default? those. get as many links horizontally as possible?

EDIT: Is there also a statistical measure of how similar the trees are? Or is it given dist.topo(tree1, tree2, method = "PH85")

?

+3


source to share





All Articles