[R-sig-phylo] basal dichotomy in phylo object
Hello, I have an unrooted tree, but I know that basal dichotomy is between nodes labeled 174 and 500. I am wandering how to indicate it in the object of class 'phylo'. I tried 'root' function of 'ape' but with no success. I will be grateful for any advice. Best wishes Ondrej Mikula -- Institute of Animal Physiology and Genetics Academy of Sciences of the Czech Republic Veveri 97, 60200 Brno, Czech Republic Institute of Vertebrate Biology Academy of Sciences of the Czech Republic Studenec 122, 67502 Konesin, Czech Republic [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] basal dichotomy in phylo object
In my phytools package (http://cran.r-project.org/web/packages/phytools/index.html) there is a function reroot() that is really just a simple wrapper around root() that allows you to root along internal or terminal edges (rather than only at nodes). In your example, assuming that the node 500 is tipward of 174 in the tree, to re-root the tree halfway along the edge leading to node number 500 (in tree$edge), you would just do: rooted.tree-reroot(tree,node.number=500,position=tree$edge.length[tree$edge[,2]==500]/2) I think. All the best, 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 10/25/2011 10:44 AM, Ondřej Mikula wrote: Hello, I have an unrooted tree, but I know that basal dichotomy is between nodes labeled 174 and 500. I am wandering how to indicate it in the object of class 'phylo'. I tried 'root' function of 'ape' but with no success. I will be grateful for any advice. Best wishes Ondrej Mikula ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] basal dichotomy in phylo object
Dear Ondrej, there is also a function midpoint in phangorn, which roots the trees in the middle of the longest path. Maybe you are lucky and your edge (500, 174) is one in the middle. Regards, Klaus On 10/25/11, Liam J. Revell liam.rev...@umb.edu wrote: In my phytools package (http://cran.r-project.org/web/packages/phytools/index.html) there is a function reroot() that is really just a simple wrapper around root() that allows you to root along internal or terminal edges (rather than only at nodes). In your example, assuming that the node 500 is tipward of 174 in the tree, to re-root the tree halfway along the edge leading to node number 500 (in tree$edge), you would just do: rooted.tree-reroot(tree,node.number=500,position=tree$edge.length[tree$edge[,2]==500]/2) I think. All the best, 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 10/25/2011 10:44 AM, Ondřej Mikula wrote: Hello, I have an unrooted tree, but I know that basal dichotomy is between nodes labeled 174 and 500. I am wandering how to indicate it in the object of class 'phylo'. I tried 'root' function of 'ape' but with no success. I will be grateful for any advice. Best wishes Ondrej Mikula ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo -- Klaus Schliep Université Paris 6 (Pierre et Marie Curie) 9, Quai Saint-Bernard, 75005 Paris ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] basal dichotomy in phylo object
Dear Liam and Klaus, thanks a lot for your suggestions. 174 and 500 are actually labels of the nodes, but I used their numbers instead and it works well. All the best Ondrej On 25 October 2011 17:28, Liam J. Revell liam.rev...@umb.edu wrote: On seeing this email, I also realized that to have node numbers up to 500, that you must have 174 tips (i.e., node number 174 is actually a tip), meaning the code I gave before should be: rooted.tree-reroot(tree,node.**number=174,position=tree$edge.** length[tree$edge[,2]==174]/2) I hope this helps. Also, thanks Klaus. - Liam -- Liam J. Revell University of Massachusetts Boston web: http://faculty.umb.edu/liam.**revell/http://faculty.umb.edu/liam.revell/ email: liam.rev...@umb.edu blog: http://phytools.blogspot.com On 10/25/2011 11:19 AM, Klaus Schliep wrote: Dear Ondrej, there is also a function midpoint in phangorn, which roots the trees in the middle of the longest path. Maybe you are lucky and your edge (500, 174) is one in the middle. Regards, Klaus On 10/25/11, Liam J. Revellliam.rev...@umb.edu wrote: In my phytools package (http://cran.r-project.org/**web/packages/phytools/index.**htmlhttp://cran.r-project.org/web/packages/phytools/index.html) there is a function reroot() that is really just a simple wrapper around root() that allows you to root along internal or terminal edges (rather than only at nodes). In your example, assuming that the node 500 is tipward of 174 in the tree, to re-root the tree halfway along the edge leading to node number 500 (in tree$edge), you would just do: rooted.tree-reroot(tree,node.**number=500,position=tree$edge.** length[tree$edge[,2]==500]/2) I think. All the best, Liam -- Liam J. Revell University of Massachusetts Boston web: http://faculty.umb.edu/liam.**revell/http://faculty.umb.edu/liam.revell/ email: liam.rev...@umb.edu blog: http://phytools.blogspot.com On 10/25/2011 10:44 AM, OndÅej Mikula wrote: Hello, I have an unrooted tree, but I know that basal dichotomy is between nodes labeled 174 and 500. I am wandering how to indicate it in the object of class 'phylo'. I tried 'root' function of 'ape' but with no success. I will be grateful for any advice. Best wishes Ondrej Mikula __**_ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/**listinfo/r-sig-phylohttps://stat.ethz.ch/mailman/listinfo/r-sig-phylo -- Institute of Animal Physiology and Genetics Academy of Sciences of the Czech Republic Veveri 97, 60200 Brno, Czech Republic Institute of Vertebrate Biology Academy of Sciences of the Czech Republic Studenec 122, 67502 Konesin, Czech Republic [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo