Re: [R-sig-phylo] rotate nodes to match taxonomic order

2015-04-08 Thread Jacob Berv
Emmanuel, Thanks! I actually realized that the reason this wasn’t working was because there were a few tiny differences between the taxon names in my two trees. Once I corrected this the rotateConstr() function works great, as does Liam’s solution. Thanks both! Jake > On Apr 8, 2015, at 1:08

Re: [R-sig-phylo] rotate nodes to match taxonomic order

2015-04-08 Thread Emmanuel Paradis
Strange... here's some code that seems to do what you describe but I don't see something unexpected in the output. A <- rcoal(200) B <- A NODES <- Ntip(B) + seq_len(B$Nnode) for (i in 1:100) B <- rotate(B, sample(NODES, size = 1)) ## to avoid line-crossing when plotting: B <- read.tree(text = wr

Re: [R-sig-phylo] rotate nodes to match taxonomic order

2015-04-08 Thread Jacob Berv
The rotateConstr() function does not give me any errors - Here is how I was trying to use it: With a 200 taxon tree (tree A), I rotated ~50 nodes using rotate() to get it how I wanted. With a mostly similar (topologically identical, but different branch lengths, so node numbers are not exactl

Re: [R-sig-phylo] rotate nodes to match taxonomic order

2015-04-08 Thread Emmanuel Paradis
Hi Jacob, Can you send an example of your output with rotateConstr()? Thanks. Best, Emmanuel Le 08/04/2015 06:41, Jacob Berv a écrit : 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 t

Re: [R-sig-phylo] rotate nodes to match taxonomic order

2015-04-08 Thread Liam J. Revell
Hi Jacob. There is a function in phytools that does something like this. It is called minRotate and it was designed to be used internally by phylo.to.map but can also be used on its own. I have blogged about your question and the function here: http://blog.phytools.org/2015/04/finding-closest

[R-sig-phylo] rotate nodes to match taxonomic order

2015-04-07 Thread Jacob Berv
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 node