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.
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
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
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
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