Hello all, I recently decided to manually edit a very large supertree (>1700 taxa) in Mesquite (I had to collapse a few nodes into polytomies, something I can only seem to do in Mesquite). I read it out of R as a Newick file, than into Mesquite, where I did my little edits and then saved the tree as a Nexus file, which I then tried to read into ape. But then I get this.
> spec_tree<-read.nexus(file.choose()) Error in if (sum(tr$edge[, 1] == ROOT) == 1 && dim(tr$edge)[1] > 1) { : missing value where TRUE/FALSE needed I also tried reading the Nexus file into TreeFig, which didn't work. If I cut out a lot of the internal structure of the Nexus file (who needs Mesquite and Taxon blocks anyway?), I can get TreeFig to read it, export it into a Newick file or a new Nexus file and then try opening it in R with read.nexus(). That works. But then i can't write it in a new file in R with write.tree() nor write.nexus(), and also plot(tree) causes R to freeze. > write.tree(spec_id_tree,file.choose()) Error in kids[[parent[i]]] : attempt to select less than one element > write.nexus(spec_id_tree,file.choose()) #NEXUS [R-package APE, Mon Feb 28 10:03:59 2011] Read 1756 items Error in 1:(start - 1) : argument of length 0 After saving and opening the file in Mesquite a bunch of times, I repeatedly found new un-collapsed double node branches on the tree. No idea where they came from (maybe a by-product of my node collapsing?). I removed the new ones that popped up, deassigned branch lengths to the tree (it's a super-cladogram) and then saved and... finally, R read the nexus file and write.tree() worked. write.nexus() didn't work (same error as above), but I can read my tree and write it, at least, so my issue is solved but I'd still like to know what was causing the problems to begin with. I have no idea where the un-collapsed double branches came from or why they were causing this issue. I am using R v2.12.2 and ape v2.6-3. So that the error is completely reproducible, I have placed two Nexus files on my website which produce both the read.nexus() error (trash_a.nex) and the write.nexus() and write.tree() errors (trash_b). These are small, partially collapsed portions of my supertree with the species names deleted. They can be found at: http://home.uchicago.edu/~dwbapst/trash_a.nex http://home.uchicago.edu/~dwbapst/trash_b.nex -Dave -- David Bapst Dept of Geophysical Sciences University of Chicago 5734 S. Ellis Chicago, IL 60637 http://home.uchicago.edu/~dwbapst/ _______________________________________________ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo