Hi all,
Is there an easy way to get R to automatically rotate the nodes of a phylogeny
to match an arbitrary ordering of the tips?
Consider the following two situations -
Situation 1:
Say I have a particular taxonomic order, such as
SpeciesA, SpeciesC, SpeciesB
And I want to rotate the nodes of ((C,B),A) to match it - ie to automatically
rotate the nodes to give (A(C,B))
Situation 2:
Say I have tree 1 ((C,B),A) and I want to rotate it’s nodes to match the order
of tree 2 (A,(B,C))
Currently the only way I know how to accomplish either scenario is to use the
ape function rotate() on each relevant node, but this quickly becomes a very
tedious task when you have hundreds of nodes to go through and want to achieve
a particular ordering.
Any thoughts or tips on how to accomplish either of the two scenarios I
describe above in a generalizable way that scales to hundreds of tips/nodes?
There is an example in the rotate() documenatation using rotateConstr():
# a simple example for rotateConstr:
A <- read.tree(text = "((A,B),(C,D));")
B <- read.tree(text = "(((D,C),B),A);")
B <- rotateConstr(B, A$tip.label)
plot(A); plot(B, d = "l")
But this doesn’t seem to work when I try it on my larger trees. Not sure where
I’m going wrong…
Best,
Jacob Berv
Ph.D. Student
Lovette Lab
Cornell Laboratory of Ornithology
[[alternative HTML version deleted]]
_______________________________________________
R-sig-phylo mailing list - [email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/[email protected]/