[R-sig-phylo] reverse order plotting of newick tree/phylo object
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
Re: [R-sig-phylo] reverse order plotting of newick tree/phylo object
Hi Liam, Thanks for the help. It works partially, one clade remains at the bottom of the plot, but since it is an unrooted tree there is no node to rotate anymore. 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? 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.nlmailto: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
[R-sig-phylo] FW: read.tree() problem?
Dear r-sig-phylo mailing list, The problem with reading a pre-computed species tree from www.microbesonline.org has been solved. See the text for details. Kind regards, Thierry Janssens -Original Message- From: Emmanuel Paradis [mailto:emmanuel.para...@ird.fr] Sent: maandag 7 maart 2011 10:50 To: Thierry Janssens - TNW Subject: Re: [R-sig-phylo] read.tree() problem? Great to read that! Can you send a small mail to the list so that it keeps other users updated too? Thanks a lot. Cheers, Emmanuel On Mon, 7 Mar 2011 10:27:23 +0100 Thierry Janssens - TNW t.k.s.janss...@tudelft.nl wrote: Dear Dr. Paradis, I discovered why the newick file is corrupt. At microbesonline.org they merge the Eukaryotic, Bacterial and Archaea trees with arbitrary branch length connections (and without any support value at these connecting nodes). When I prune the tree by hand to the Bacteria it just works. As an attachment the newick file with NCBI TaxIDs. Thank you very much for your help. 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: Emmanuel Paradis [mailto:emmanuel.para...@ird.fr] Sent: maandag 7 maart 2011 4:34 To: Thierry Janssens - TNW Cc: r-sig-phylo@r-project.org Subject: Re: [R-sig-phylo] read.tree() problem? Hi Thierry, I suggest you send your tree as a file (I think r-sig-phylo accepts attachments with simple text), or you mention a URL where we can download it. I try to save the tree from your email but this is a bit difficult because mailer programs often break lines in an unpredictable way. I was able to reproduce the error with R (can read but can't plot). FigTree can't read and says missing closing ')'. Phylip can read and draw with 'drawgram' but the program says no branch lengths which is strange since the tree has some. If I open the Newick file with Emacs, the highlighting parentheses tells me that the most outer parentheses do not match. So, it's surprising that Phylip can read the tree while other programs detect a problem with it. Maybe we'll see clearer if you post the original file. Cheers, Emmanuel Thierry Janssens - TNW wrote on 04/03/2011 04:25: Dear R phylogeneticists, I am trying to make a species tree based on a newick file (at the end of this message)of a pre-computed tree from microbesonline.org. I can read it into ape but unlike with other files of the same format, there something weird going on with the the node.labels and I can not plot the tree. When I convert the newick to a nexus in FigTree (or similar software) and I import that file I get an object that I am able to plot but which does not contain node.labels. What is going on here? library(ape) test - read.tree(speciesTree.tree) plot(test) Error in .nodeDepthEdgelength(Ntip, Nnode, z$edge, Nedge, z$edge.length) : NA/NaN/Inf in foreign function call (arg 6) str(test) List of 5 $ edge : int [1:3208, 1:2] 1608 1609 1610 1611 1612 1612 1613 1614 1614 1613 ... $ Nnode : int 1602 $ tip.label : chr [1:1607] 439481 273075 273116 263820 ... $ edge.length: num [1:3208] 0.3003 0.0758 0.0751 0.243 0.4137 ... $ node.label : chr [1:1602] 1.000 0.968 1.000 ... - attr(*, class)= chr phylo Further some tip.labels (NCBI TaxID) are appearing in the list of node labels. For example label 82: t$node.label[1:100] [1]1.000 0.968 1.000 1.000 1.000 1.000 1.000 [9] 0.816 1.000 1.000 1.000 1.000 1.000 0.856 1.000 [17] 0.999 1.000 1.000 1.000 1.000 1.000 1.000 1.000 [25] 1.000 0.959 1.000 1.000 1.000 1.000 1.000 0.198 [33] 1.000 1.000 0.556 1.000 1.000 1.000 1.000 1.000 [41] 0.999 1.000 1.000 1.000 1.000 0.917 0.997 1.000 [49] 1.000 1.000 1.000 1.000 1.000 1.000 0.991 1.000 [57] 1.000 1.000 1.000 1.000 1.000 0.999 1.000 1.000 [65] 1.000 1.000 1.000 1.000 0.702 1.000 0.977 0.332 [73] 1.000 1.000 1.000 1.000 1.000 0.976 1.000 1.000 [81] 0.672 573235 1.000 1.000 1.000 1.000 1.000 1.000 [89] 1.000 1.000 1.000 1.000 1.000 1.000 1.000 0.903 [97] 1.000 1.000 1.000 1.000 (439481:0.41366,((273075:0.18185,273116:0.17816)1.000:0.22103,(26382 0:0.27526,333146:0.30399)1.000:0.16055)1.000:0.38085)1.000:0.24304,( 410358:0.39459,(323259:0.29789,(368407:0.24135,(521011:0.29254,456442:0. 23028)1.000:0.04929)0.856:0.04692)1.000:0.08466)1.000:0.27653,((349307:0 .42297,((269797:0.05978,(192952:0.05998,188937:0.04646)1.000:0.02884)1.0 00:0.18123,(259564:0.18732,547558:0.20549)1.000:0.09293)1.000:0.15488)1. 000:0.09987,(304371:0.48259,519442:0.19178,(272569:0.12730,485914:0. 13571)1.000:0.05289)1.000:0.06663,(416348:0.17178,(309800
[R-sig-phylo] read.tree() problem?
Dear R phylogeneticists, I am trying to make a species tree based on a newick file (at the end of this message)of a pre-computed tree from microbesonline.org. I can read it into ape but unlike with other files of the same format, there something weird going on with the the node.labels and I can not plot the tree. When I convert the newick to a nexus in FigTree (or similar software) and I import that file I get an object that I am able to plot but which does not contain node.labels. What is going on here? library(ape) test - read.tree(speciesTree.tree) plot(test) Error in .nodeDepthEdgelength(Ntip, Nnode, z$edge, Nedge, z$edge.length) : NA/NaN/Inf in foreign function call (arg 6) str(test) List of 5 $ edge : int [1:3208, 1:2] 1608 1609 1610 1611 1612 1612 1613 1614 1614 1613 ... $ Nnode : int 1602 $ tip.label : chr [1:1607] 439481 273075 273116 263820 ... $ edge.length: num [1:3208] 0.3003 0.0758 0.0751 0.243 0.4137 ... $ node.label : chr [1:1602] 1.000 0.968 1.000 ... - attr(*, class)= chr phylo Further some tip.labels (NCBI TaxID) are appearing in the list of node labels. For example label 82: t$node.label[1:100] [1]1.000 0.968 1.000 1.000 1.000 1.000 1.000 [9] 0.816 1.000 1.000 1.000 1.000 1.000 0.856 1.000 [17] 0.999 1.000 1.000 1.000 1.000 1.000 1.000 1.000 [25] 1.000 0.959 1.000 1.000 1.000 1.000 1.000 0.198 [33] 1.000 1.000 0.556 1.000 1.000 1.000 1.000 1.000 [41] 0.999 1.000 1.000 1.000 1.000 0.917 0.997 1.000 [49] 1.000 1.000 1.000 1.000 1.000 1.000 0.991 1.000 [57] 1.000 1.000 1.000 1.000 1.000 0.999 1.000 1.000 [65] 1.000 1.000 1.000 1.000 0.702 1.000 0.977 0.332 [73] 1.000 1.000 1.000 1.000 1.000 0.976 1.000 1.000 [81] 0.672 573235 1.000 1.000 1.000 1.000 1.000 1.000 [89] 1.000 1.000 1.000 1.000 1.000 1.000 1.000 0.903 [97] 1.000 1.000 1.000 1.000 (439481:0.41366,((273075:0.18185,273116:0.17816)1.000:0.22103,(263820:0.27526,333146:0.30399)1.000:0.16055)1.000:0.38085)1.000:0.24304,(410358:0.39459,(323259:0.29789,(368407:0.24135,(521011:0.29254,456442:0.23028)1.000:0.04929)0.856:0.04692)1.000:0.08466)1.000:0.27653,((349307:0.42297,((269797:0.05978,(192952:0.05998,188937:0.04646)1.000:0.02884)1.000:0.18123,(259564:0.18732,547558:0.20549)1.000:0.09293)1.000:0.15488)1.000:0.09987,(304371:0.48259,519442:0.19178,(272569:0.12730,485914:0.13571)1.000:0.05289)1.000:0.06663,(416348:0.17178,(309800:0.14632,362976:0.22736)1.000:0.04936)1.000:0.07360)0.959:0.02906,(543526:0.07924,547559:0.09120)1.000:0.12613)1.000:0.03587,((64091:0.01211,478009:0.01490)1.000:0.25743,348780:0.19640)0.198:0.03090)1.000:0.55052)1.000:0.07698)0.999:0.05058)1.000:0.09364,(589924:0.17934,(224325:0.21041,572546:0.19014)0.556:0.04962)1.000:0.30444)1.000:0.10302,(190192:0.56974,(((579137:0.06450,(573064:0.04741,(644281:0.04559,243232:0.02655)0.9! 99:0.01412)1.000:0.02564)1.000:0.14286,(419665:0.20295,(456320:0.20887,(406327:0.11663,(267377:0.03076,(444158:0.02979,(402880:0.02558,426368:0.02885)0.997:0.01116)0.917:0.01288)1.000:0.07452)1.000:0.10863)1.000:0.07147)1.000:0.12117)1.000:0.28354,(187420:0.25693,(339860:0.35833,(634498:0.17713,(483214:0.01893,420247:0.00835)1.000:0.18076)1.000:0.13696)1.000:0.08348)1.000:0.23107)1.000:0.06187)1.000:0.06638)1.000:0.06050,((186497:0.07369,(272844:0.05703,70601:0.06535)1.000:0.04269)1.000:0.04899,((523850:0.06243,(593117:0.08395,69014:0.05940)1.000:0.03177)1.000:0.04695,604354:0.17391)0.991:0.03991)1.000:0.40754)0.816:0.05334)1.000:0.07506,(374847:0.86370,(((399549:0.28664,(((419942:0.00945,((427317:0.00339,(427318:0.01006,(439386:0.00431,(429572:0.00860,425944:0.00718)0.702:0.00350)1.000:0.00768)1.000:0.00687)1.000:0.00883,426118:0.00469)1.000:0.00698)1.000:0.03435,273057:0.03935)1.000:0.22126,(273063:0.16241,330779:0.23385)1.000:0.09486)0.999:0.06116)1.000:0.36497,(453591:0! .58225,((399550:0.25550,490899:0.35284)1.000:0.29540,(272557:0.49043,4 15426:0.37241)1.000:0.09504)0.332:0.05490)0.977:0.06581)1.000:0.10572,(368408:0.62607,(397948:0.48339,(410359:0.11541,((384616:0.10334,444157:0.09754)1.000:0.06636,(178306:0.10490,340102:0.12129)1.000:0.04586)0.976:0.03664)1.000:0.36391)1.000:0.23659)1.000:0.09120)1.000:0.10084)1.000:0.10484)0.968:0.07584,(228908:1.13372,436308:0.93004)0.672:0.06449)1.000:0.300325,((544712:0.04315,544711:0.00191)1.000:0.00541,((559297:0.00156,559298:0.00369)1.000:0.03726,((502779:0.01514,(502780:0.00942,482561:0.00575)1.000:0.00976)1.000:0.06129,(13684:0.10880,(29001:0.09167,45151:0.05697)1.000:0.04358)1.000:0.18726,(383855:0.13130,336722:0.12536)1.000:0.19196)1.000:0.06920,(((284591:0.45378,(((284593:0.22042,(4932:0.00197,285006:0.00211)1.000:0.17446)1.000:0.08155,(284590:0.22857,284811:0.26462)1.000:0.04565)1.000:0.23145,(36911:0.26135,(((36914:0.21797,(5482:0.10393,(237561:0.50355,5476:0.00751)1.000:0.08536)1.000:0.06917)1.000:0.08746,322104:0.15539)1.000:0.04851,(284592:0.14314,4929:!