[R-sig-phylo] edge representation of trees produced by birthdeath.tree() in geiger
Hi all, While simulating some trees using the birthdeath.tree() function in geiger I noticed an inconsistency between the node/tip labels in the edge matrix and in a plot of the tree. I dumped in the text of one of the trees I produced as an example. library(ape) tre-read.tree(text=8:2.850732306,9:0.1789410068):1.147884602,3:0.8848821048):1.411242805,(1:3.869881809,((6:0.6904865854,7:0.02044458561):1.984259398,2:0.04497273798):0.3022512176):0.09298177296):0.3029547699,(4:0.8015431218,5:1.467916249):2.117025776);) plot(tre) nodelabels() tre$edge Note that the edge matrix contains edges that shouldn't exist based on the plot. For instance, there should be no edge between node 13 and tip 1 based on the plot, but there it is in the fourth row of the edge matrix. My feeling is this has to do with the way the tips are getting labeled by the birthdeath.tree() function but I can't quite figure it out. Any ideas? Thanks, Andrew Barr PhD Candidate University of Texas at Austin ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] edge representation of trees produced by birthdeath.tree() in geiger
Hi Andrew. This is because the numbers in tre$edge are node tip numbers, not tip labels (which also can be numbers). The translation between tip numbers and tip labels is given by tre$tip.label. Here, tip labels are indexed by their numbers in tre$edge. For instance, in your case we have: tre$edge [,1] [,2] [1,] 10 11 [2,] 11 12 [3,] 12 13 [4,] 131 [5,] 132 ... (some rows excluded) and: tre$tip.label [1] 8 9 3 1 6 7 2 4 5 This tells us, to take your example, that node 13 should be connected to tips 1 2, which tre$tip.label tells us have labels 8 9, just as we see with: plot(tre); nodelabels() I hope this clears things up somewhat. 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 9/9/2011 7:51 AM, Andrew Barr wrote: library(ape) tre-read.tree(text=8:2.850732306,9:0.1789410068):1.147884602,3:0.8848821048):1.411242805,(1:3.869881809,((6:0.6904865854,7:0.02044458561):1.984259398,2:0.04497273798):0.3022512176):0.09298177296):0.3029547699,(4:0.8015431218,5:1.467916249):2.117025776);) ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo