This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Get support value of MRCA given a list of tip.label in R newick trees

I am working in R with a tree that has edge, edge.length, Nnode, node.label (the actual support values) and tip.label fields. This tree was build using fasttree.

For each taxonomic group in my tree I can find their MRCA given the list of tip.label passed to the getMRCA() function.

What I am trying to do is to find the support value associated to my MRCAs, meaning the support value to my MRCA subtrees. I can find it manually inspecting the tree with TreeViewer or Archaeopteryx but I found no way to do that in R and I am a bit confused by the structure of node.label in phylo objects.

Maybe I don't use the right key-words to describe what I intent to do, neverless I did not find any trick to do what I want on forums.

Any suggestions/links appreciated,

Paul

phylogeny newick r ape tree

1 answer

Yes, this is quite confusing, and I wish this could be resolved in one of the phylogeny packages. In any case, here is how you can get it:

mrca = getMRCA(tree, c('sp1','sp2','sp3'))
mrca_label = tree$node.label[mrca-length(tree$tip.label)]

Thank you very much, I understand how it works now. Simple trick but not that obvious and definitly not easy to find in documentations!

Log in to answer this question.