Hi Stacey,
Quoting [email protected]:
Hi all,
I have a little problem with write.nexus. In part of my script, I need
to read
in some trees, write them out, then repeat. I find that they read back in
fine, but when I write them out the second time, there are no trees in the
files. Oddly, this problem doesn't occur if I use write.tree the first time
and write.nexus the second time. However, using write.tree loses the taxon
order and I need to keep the original order.
Anyway here are a few commands demonstrating the issue
library(ape)
trees<-read.tree(text="((a:1,b:1):1,c:2); ((c:1,b:1):1,a:2);")
plot(trees[[1]])
plot(trees[[2]])
##both look fine
write.nexus(trees,file="test.nex")
##this file looks fine
trees2<-read.nexus(trees,file="test.nex")
This line should be 'trees2 <- read.nexus(file="test.nex")', but it
works anyway because you named your file argument; it just has the
side effect of giving odd names to the returned list.
plot(trees2[[1]])
plot(trees2[[2]])
##again look fine
write.nexus(trees2,file="test2.nex")
#this file has no trees in it! and no taxa either for that matter!
It is fixed now; the new version is here:
https://svn.mpl.ird.fr/ape/dev/ape/R/write.nexus.R
Cheers,
Emmanuel
I'd be much obliged for any pointers!
Cheers,
Stacey
_______________________________________________
R-sig-phylo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
_______________________________________________
R-sig-phylo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo