> But can you explain to me what is the rationale behind this? There are > only 47 nodes and 54 tips. How can the nodes from 55 to 47 than be > rotated?
Liam's code is rotating nodes 55+(1:47), rather than 55 to 47. The internal node indexing in ape's phylo class starts with "number of tips plus 1". Thus, using rotate on nodes starting with length(phy$tip.label) + 1 means it is starting with node 56 (the root node) and going through length(phy$tip.label) + phy$Nnode, e.g.,, all internal nodes. You can see that 55+(1:47) gives a vector of node numbers that is not the same as 55 to 47. If it isn't working right - maybe it is that you have polytomies? I think you should have n-1 internal nodes (53 in your case). Try multi2di (from ape) for polytomy resolution and see if it works as desired. ~Dan Rabosky > > Kind regards, > > Thierry > > Thierry Janssens > Postdoctoral researcher > Delft University of Technology > Bionanoscience > Kavli Institute of Nanoscience > Lorentzweg 1 > 2628LJ Delft > the Netherlands > Tel: +31 15 2781175 > Fax:+31 15 2781202 > e-mail: t.k.s.janss...@tudelft.nl > > -----Original Message----- > From: Liam J. Revell [mailto:liam.rev...@umb.edu] > Sent: donderdag 17 maart 2011 16:11 > To: Thierry Janssens - TNW > Cc: r-sig-phylo@r-project.org > Subject: Re: [R-sig-phylo] reverse order plotting of newick tree/phylo > object > > Hi Thierry, > > There might be a more elegant way to do this, but you can just apply the > "ape" function rotate() to each node number of the tree (excluding > tips). > > I.e. > >> tr2<-tree >> for(i in length(tr2$tip)+1:tr2$Nnode) tr2<-rotate(tr2,i) > plot(tr2) > > [rotate() may also be able to take a vector of nodes, but I was not able > to get this to work.] > > - Liam > > -- > Liam J. Revell > University of Massachusetts Boston > web: http://faculty.umb.edu/liam.revell/ > email: liam.rev...@umb.edu > blog: http://phytools.blogspot.com > > On 3/17/2011 10:51 AM, Thierry Janssens - TNW wrote: >> Dear R-sig-phylo, >> >> >> >> I am looking for a method to plot an unrooted tre/phylo object e in >> the reverse order (of the tip labels). Like all the nodes would have >> rotated. >> >> >> >> Any of you has an idea? >> >> >> >> Kind regards, >> >> >> >> Thierry >> >> >> >> Thierry Janssens >> >> Postdoctoral researcher >> >> Delft University of Technology >> >> Bionanoscience >> >> Kavli Institute of Nanoscience >> >> Lorentzweg 1 >> >> 2628LJ Delft >> >> the Netherlands >> >> Tel: +31 15 2781175 >> >> Fax:+31 15 2781202 >> >> e-mail: t.k.s.janss...@tudelft.nl<mailto:t.k.s.janss...@tudelft.nl> >> >> >> >> >> [[alternative HTML version deleted]] >> >> _______________________________________________ >> R-sig-phylo mailing list >> R-sig-phylo@r-project.org >> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo > > _______________________________________________ > R-sig-phylo mailing list > R-sig-phylo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-phylo [[alternative HTML version deleted]] _______________________________________________ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo