liamrevell / phytools

GNU General Public License v3.0
207 stars 56 forks source link

read.newick freezes when reading newick text with one tip only #31

Closed LunaSare closed 1 year ago

LunaSare commented 5 years ago

I realize this is something that most users would have rarely encounter, since most of them would certainly know how their newick string looks like before trying to read it into R. And It wouldn't make any sense trying to read a phylogeny with one tip only. However, I discovered this behaviour when I was trying to read a bunch of newick strings I have not looked before into R. They were generated with the rphylotastic package, which basically takes a vector of taxa and subsets trees from databases by matching those taxa. Sometime only one taxon is matched in the source tree, so the subset tree looks like the following: "Ursus_americanus;" Then, trying to read this into a phylo object with read.newick(text = "Ursus_americanus;" freezes R. Not a big deal, just thought it might be useful to share that this is happening.

liamrevell commented 1 year ago

Sorry! Perhaps ape::read.tree can handle this.