Re: [R-sig-phylo] Force read.nexus() to return a multiPhylo object, even if there is only one tree
Ahhh. I see. I missed the part in Yan's original email about the names. All the best, Liam Liam J. Revell, Associate Professor of Biology University of Massachusetts Boston web: http://faculty.umb.edu/liam.revell/ email: liam.rev...@umb.edu blog: http://blog.phytools.org On 12/28/2016 6:45 AM, Emmanuel Paradis wrote: Hi Liam, Actually, this can be done with c(): R> tr <- rtree(10) R> c(tr) 1 phylogenetic trees With respect to Yan's initial query, this will not restore the tree name from the NEXUS file which is (currently) lost if there is a single tree. Best, Emmanuel Le 28/12/2016 à 03:11, Liam J. Revell a écrit : Hi Yan. In case it is useful I just pushed an update to phytools in which I have added an as.multiPhylo method for objects of class "phylo". This will also return an object of class "multiPhylo" if that is already the object class. This means that: obj<-as.multiPhylo(read.nexus(...)) in which ... are the arguments to read.nexus, will return an object of class "multiPhylo" with length 1 if the file contains only one tree - but will also return an object of class "multiPhylo" if the file has 2 or more trees. To get this one needs to install phytools from GitHub using devtools: library(devtools) install_github("liamrevell/phytools") All the best, Liam Liam J. Revell, Associate Professor of Biology University of Massachusetts Boston web: http://faculty.umb.edu/liam.revell/ email: liam.rev...@umb.edu blog: http://blog.phytools.org On 12/27/2016 5:11 PM, Yan Wong wrote: On 27 Dec 2016, at 22:08, Emmanuel Paradiswrote: Hi Yan, Yes, you are right: this modification can be done. In the meantime, you can fix the code with: fix(read.nexus) Find this line (#117): if (Ntree == 1) { and change it to: if (FALSE) { save and close. Tell me if you still have problem. Yes, that works fine. Thanks a lot. Yan ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/ ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/ ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
Re: [R-sig-phylo] Force read.nexus() to return a multiPhylo object, even if there is only one tree
Hi Liam, Actually, this can be done with c(): R> tr <- rtree(10) R> c(tr) 1 phylogenetic trees With respect to Yan's initial query, this will not restore the tree name from the NEXUS file which is (currently) lost if there is a single tree. Best, Emmanuel Le 28/12/2016 à 03:11, Liam J. Revell a écrit : Hi Yan. In case it is useful I just pushed an update to phytools in which I have added an as.multiPhylo method for objects of class "phylo". This will also return an object of class "multiPhylo" if that is already the object class. This means that: obj<-as.multiPhylo(read.nexus(...)) in which ... are the arguments to read.nexus, will return an object of class "multiPhylo" with length 1 if the file contains only one tree - but will also return an object of class "multiPhylo" if the file has 2 or more trees. To get this one needs to install phytools from GitHub using devtools: library(devtools) install_github("liamrevell/phytools") All the best, Liam Liam J. Revell, Associate Professor of Biology University of Massachusetts Boston web: http://faculty.umb.edu/liam.revell/ email: liam.rev...@umb.edu blog: http://blog.phytools.org On 12/27/2016 5:11 PM, Yan Wong wrote: On 27 Dec 2016, at 22:08, Emmanuel Paradiswrote: Hi Yan, Yes, you are right: this modification can be done. In the meantime, you can fix the code with: fix(read.nexus) Find this line (#117): if (Ntree == 1) { and change it to: if (FALSE) { save and close. Tell me if you still have problem. Yes, that works fine. Thanks a lot. Yan ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/ ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/ ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
Re: [R-sig-phylo] Force read.nexus() to return a multiPhylo object, even if there is only one tree
Hi Yan. In case it is useful I just pushed an update to phytools in which I have added an as.multiPhylo method for objects of class "phylo". This will also return an object of class "multiPhylo" if that is already the object class. This means that: obj<-as.multiPhylo(read.nexus(...)) in which ... are the arguments to read.nexus, will return an object of class "multiPhylo" with length 1 if the file contains only one tree - but will also return an object of class "multiPhylo" if the file has 2 or more trees. To get this one needs to install phytools from GitHub using devtools: library(devtools) install_github("liamrevell/phytools") All the best, Liam Liam J. Revell, Associate Professor of Biology University of Massachusetts Boston web: http://faculty.umb.edu/liam.revell/ email: liam.rev...@umb.edu blog: http://blog.phytools.org On 12/27/2016 5:11 PM, Yan Wong wrote: On 27 Dec 2016, at 22:08, Emmanuel Paradiswrote: Hi Yan, Yes, you are right: this modification can be done. In the meantime, you can fix the code with: fix(read.nexus) Find this line (#117): if (Ntree == 1) { and change it to: if (FALSE) { save and close. Tell me if you still have problem. Yes, that works fine. Thanks a lot. Yan ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/ ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
Re: [R-sig-phylo] Force read.nexus() to return a multiPhylo object, even if there is only one tree
On 27 Dec 2016, at 22:08, Emmanuel Paradiswrote: > Hi Yan, > > Yes, you are right: this modification can be done. In the meantime, you can > fix the code with: > > fix(read.nexus) > > Find this line (#117): > >if (Ntree == 1) { > > and change it to: > >if (FALSE) { > > save and close. Tell me if you still have problem. Yes, that works fine. Thanks a lot. Yan ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
Re: [R-sig-phylo] Force read.nexus() to return a multiPhylo object, even if there is only one tree
Hi Yan, Yes, you are right: this modification can be done. In the meantime, you can fix the code with: fix(read.nexus) Find this line (#117): if (Ntree == 1) { and change it to: if (FALSE) { save and close. Tell me if you still have problem. Best, Emmanuel Le 27/12/2016 à 21:15, Yan Wong a écrit : Hi I’m doing some analysis in which I produce a variable number of phylogenetic trees with the same tips in a nexus file, then import them into R for analysis (these are trees along a genome). The name of each tree is meaningful (it is a position along the genome). However, in a few simulations, the nexus file has only a single tree in it. In this case, read.nexus returns not a multiPhylo object, but a single tree, with the name of the tree lost. I wonder if it would be sensible to have a force.multi option to read.nexus(), by default set to FALSE (to retain compatibility), but which, if set to TRUE, returns a multiPhylo object even if there is only one tree in the file? Yan ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/ Pour nous remonter une erreur de filtrage, veuillez vous rendre ici : http://f.security-mail.net/407pvJ9zSVE ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/