thibautjombart / treespace

Explore spaces of phylogenetic trees
https://thibautjombart.github.io/treespace/
Other
27 stars 9 forks source link

TreeConcordance - very sensitive to small changes in backbone #5

Open thackl opened 6 years ago

thackl commented 6 years ago

Hi,

I'm trying to use treespace for the comparison of individual gene phylogenies to overall "species" phylogenies. Most of my data is from single-cell sequencing, which means individual genomes and gene sets are incomplete, and therefore tree leaf sets between trees are not identical. I was pretty excited when I read your tutorial on "Comparing trees by tip label categories" because it looks like an approach that could help me a lot with my analyses.

However, I came across an issue when trying to use treeConcordance to compare gene trees to the overall phylogeny (see figure below). The Category tree represents the expected topology for certain subclades, the two individual trees represent trees obtained from single gene families. Tree 1 is in absolute agreement with the reference tree, and also gets a treeConcordance of 1. Tree 2 is not identical, though at least naively I would say quite similar to the reference tree. However, treeConcordance is only 0.2.

concordance-issue

After reading the tutorial more carefully and looking at the source code, I think I understand why: the "same placement" of a clade in the categorial tree and the individual tree is determined by the depth of the clade-MRCA in the tree (correct me if I am wrong). So because in Tree 2, the most basal clade is split into two clades, an additional depth level is introduced, MRCA-depths of all other clades are shifted, and they don't contribute to concordance anymore.

I guess this is the expected behaviour of the treeConcordance, although it seems counterintuitive. Unfortunately, it also makes treeConcordance unsuitable for the type of comparison I would like to do. Do you have any idea for alternative measurements, workaround or other methods that I could use in my situation?

Cheers Thomas

MichelleKendall commented 6 years ago

Hi Thomas,

Thanks for getting in touch. It's great to hear that the treeConcordance idea could be useful for you and I'm sorry that's it's unsuitable for your analysis as it stands. We are in the process of redrafting that paper / code and all suggestions are very welcome.

Thanks for your detailed example and yes you're absolutely right about what's going on. I can see that the function is working as intended but I agree that the emphasis on root position is giving a low score for Ind Tree 2 and obscuring the fact that a major clade is in full agreement with the category tree. It is difficult within a single score measure to capture all the possible tree differences which people may or may not care about but I will have a think about how we could handle this better. In the meantime, some ideas:

I hope that helps. Do please let me know if you have any further queries or ideas because I am keen to make this measure as useful as possible.

Cheers,

Michelle

thackl commented 6 years ago

Hi Michelle,

thanks for the quick and detailed answer. Good to hear that I got the issue right, and not just screwed up using your code / interpreting the data. I absolutely get your point about the difficulties of finding a single score measurement that captures everything. Bad luck for my current question...

The rooting/outgroup is a good point. I've already implemented that for my real data. And I think, in my case, it makes things even worse. Although, I don't think it really matters, because now that I understand the treeConcordance measurement a bit better, I see that I went about this entire analysis a bit too naively.

My outgroup in the gene trees (center and bottom row) is a stable, basal clade. But it is also only a subclade within the red category. And the rest of that red category is messy, and not at all monophyletic clade. And because of that basically all my trees end up having the same very low TreeConcordance when I compare them two the simple category trees (top panel) - only the outgroup taxa have the right MRCA-depth, everything else is deeper. cat-and-ind-trees.

I need to think about this a bit more, but it seems like I have to go about this from different angle. And just in case you have another minute to think about it. My actual question is: Which of my gene trees look more like the "canonical" topology (here 708 and 710), and which look more like the "rearranged" tree (709, 711). Any pointers would be highly appreciated.

Cheers Thomas

MichelleKendall commented 6 years ago

Ok great, thanks, that's helpful. I definitely need to think about this a bit more, too!

In response to your "actual question": since the key difference between your "canonical" and "rearranged" trees is regarding the relative positions of blue, green, pink and yellow, could it work to just prune red out of all your trees (category and individual) and re-run treeConcordance on those pruned trees? Then the measure won't be focusing on something you don't care much about. Or am I missing something?

The other thing that springs to mind is that you could run "relatedTreeDist" on all your gene trees (again, possibly after pruning out red). You may find that you get some tight clustering - in an ideal world, if you got a big cluster with 708 in the middle and a big cluster with 709 in the middle, you would have essentially sorted your trees into "canonical-like" and "rearranged-like". Of course, it probably won't be quite that tidy but I wouldn't be surprised if you see some grouping. I'd be interested to hear if that test has any power to shed light on the question.

Cheers,

Michelle