Re: [R-sig-phylo] Trying to read a tree with numerical node labels, but without edge length

2014-08-30 Thread Emmanuel Paradis
Hi Liam and others, read.nexus() can read NEXUS files that have no TRANSLATE block. There are two problems with this file: the extra spaces between "begin.../end" and the semicolon, and the linebreak between the tree declaration and the Newick string. So the following file can be read by read.

Re: [R-sig-phylo] Trying to read a tree with numerical node labels, but without edge length

2014-08-29 Thread Liam J. Revell
Actually, on second thought length(obj)>1 was supposed to be length(obj)==1 but it turns out not to matter, so you can just use: readNexus<-function(file){ obj<-readLines(file) obj<-strsplit(obj[grep("=",obj)]," ") obj<-sapply(obj,function(x) x[length(x)]) read

Re: [R-sig-phylo] Trying to read a tree with numerical node labels, but without edge length

2014-08-29 Thread Liam J. Revell
Hi Daniel. I think the problem is actually that read.nexus expects a translation table, and has nothing to do with the labels. You could use this simplified reading function which does not permit a translation table & uses phytools read.newick internally: library(phytools) readNexus<-funct

Re: [R-sig-phylo] Trying to read a tree with numerical node labels, but without edge length

2014-08-29 Thread François Michonneau
Hi Daniel, You may want to try to change the options with phylobase: phylobase.options(allow.duplicated.labels="ok") and then try reading your tree. Feel free to send me your tree if needed. cheers, -- François On Fri, Aug 29, 2014 at 10:42 PM, Daniel Rafael Miranda-Esquivel < dmiran

[R-sig-phylo] Trying to read a tree with numerical node labels, but without edge length

2014-08-29 Thread Daniel Rafael Miranda-Esquivel
Dear all, I tried to read a tree like this: #NEXUS begin trees ; tree tagged_tree = [&U] (A,(B,(C,D)60)100); end ; using read.nexus; while figtree reads it, ape refuses, telling that there is an error: Error in start:end : NA/NaN argument I tried readNexus in phylobase, but there is a problem