Is there a software that can compare phylogenetic trees to each othe (face to face comparison)?
2
1
Entering edit mode
9.8 years ago
litinskys ▴ 10

Hi, I'm currently working on several (seven) phylogenetic trees and I want to compare them to each other in the same time. I want to find what part of them is consistent.

Does anyone know a good software?

Thanks for help :)

comparison visualization tree phylogenetics • 6.9k views
ADD COMMENT
6
Entering edit mode
4.0 years ago
ron ▴ 60

Here is a solution with ggtree for face to face trees:

library(ggplot2)  
library(ggtree)  
library(cowplot)

set.seed(8455)  
t1 <- rtree(20)  
t2 <- rtree(20)  


T1 <- ggtree(t1 ) +    
  theme_tree2(legend.position='none', plot.margin = unit(c(0,0,0,0),"cm")) +   
  geom_tiplab()   


T2 <- ggtree(t2) +   
  theme_tree2(legend.position='none', plot.margin = unit(c(0,0,0,0),"cm")) +   
  geom_tiplab(hjust =1) +   
  scale_x_reverse()     


d1 = T1$data[T1$data$isTip,]  
d1$x[] = 1  
d2 = T2$data[T2$data$isTip,]  
d2$x[] = 2  

TTcon <- rbind(d1, d2)  

T1 = ggtree(t1 ) +    
  theme_tree2(legend.position='none', plot.margin = unit(c(0,0,0,0),"cm")) +   
  geom_tiplab(align = TRUE) # if required +   xlim(0,5.2)  
T2 = ggtree(t2) +   
  theme_tree2(legend.position='none', plot.margin = unit(c(0,0,0,0),"cm")) +   
  geom_tiplab(hjust =1, align = TRUE) +   
  scale_x_reverse() # if required add within scale_x_reverse() -> limits = c(5.2, 0))  

L1 = ggplot(TTcon, aes(x = x, y = y, colour = label, group = label)) + geom_line() +   
  theme_void() + theme(legend.position="none", plot.margin = unit(c(1,0,1,0),"cm"))  

cowplot::plot_grid(T1, L1 ,T2, nrow = 1, align = "hv")
ADD COMMENT
1
Entering edit mode

Thanks for the code! However, I find that my lines are not fully aligned. I figure this is because one tree is missing branches in the other, also shown in this example:

t1 <- rtree(50)  
t2 <- rtree(20)

T1 <- ggtree(t1 ) +    
  theme_tree2(legend.position='none', plot.margin = unit(c(0,0,0,0),"cm")) +   
  geom_tiplab()   


T2 <- ggtree(t2) +   
  theme_tree2(legend.position='none', plot.margin = unit(c(0,0,0,0),"cm")) +   
  geom_tiplab(hjust =1) +   
  scale_x_reverse()     


d1 = T1$data[T1$data$isTip,]  
d1$x[] = 1  
d2 = T2$data[T2$data$isTip,]  
d2$x[] = 2  

TTcon <- rbind(d1, d2)  

T1 = ggtree(t1 ) +    
  theme_tree2(legend.position='none', plot.margin = unit(c(0,0,0,0),"cm")) +   
  geom_tiplab(align = TRUE) # if required +   xlim(0,5.2)  
T2 = ggtree(t2) +   
  theme_tree2(legend.position='none', plot.margin = unit(c(0,0,0,0),"cm")) +   
  geom_tiplab(hjust =1, align = TRUE) +   
  scale_x_reverse() # if required add within scale_x_reverse() -> limits = c(5.2, 0))  

L1 = ggplot(TTcon, aes(x = x, y = y, colour = label, group = label)) + geom_line() +   
  theme_void() + theme(legend.position="none", plot.margin = unit(c(1,0,1,0),"cm"))  

cowplot::plot_grid(T1, L1 ,T2, nrow = 1, align = "hv")

enter image description here

Is there a way to account for that and only have lines drawn for the matching tip labels?

ADD REPLY
1
Entering edit mode

hello, I have same problem, but I found this is because the padding beteween figure and x axis in line chart. you can chage this by follow this answer on stackoverflow: https://stackoverflow.com/a/52318834.

but I still can't let each line align to each tip perfectly:)

ADD REPLY
0
Entering edit mode

Can you provide an example plot otherwise this code does not tell a user what to expect. Use the directions here: How to add images to a Biostars post

ADD REPLY
0
Entering edit mode

Comparison face to face of two random phylogenetic trees

enter image description here

ADD REPLY
0
Entering edit mode
9.8 years ago

You can do tree comparison with ete2, although I am not sure it is in the way you meant: https://pythonhosted.org/ete2/tutorial/tutorial_trees.html#comparing-trees

ADD COMMENT
0
Entering edit mode

Thank you for your response.

The link you sent refers to compering between only 2 trees. I am looking for a software which shall allow me to compare all 7 trees together, in the same time.

Is there anything you may recommend?

ADD REPLY
0
Entering edit mode

I don't know of anything that would do multiple trees. You may have to do multiple pairwise comparisons or compare each tree to some reference tree structure.

ADD REPLY

Login before adding your answer.

Traffic: 2119 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6