Hi Nicholas.

I think this is a bug. Try the following to circumvent:

write.nexus.data(as.list(data), file="test.nex", interleaved=TRUE,
        charsperline=100)

Since I don't have your dataset, I can't check it; but it fixed the problem in another dataset with which I was able to reproduce the error.

All the best, Liam

Liam J. Revell, Assistant Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://blog.phytools.org

On 9/17/2014 10:46 PM, Nicholas Crouch wrote:
Hi,

I am having a problem with write.nexus.data, such that the file generated
is nonsense.

I have a very, very large data set, but have been working with a subset
trying to solve this problem. My data is in .fasta format, and I am looking
to convert it into nexus format.

I load the data:

library(ape)
data <- read.dna("concat.fasta", format="fasta", as.matrix=TRUE)

This gives the following:

data
5 DNA sequences in binary format stored in a matrix

     All sequences of same length: 5023

     Labels: Species etc.

     Base composition: a c g t

Also:

class(data)
"DNAbin"

This is exactly the same as the woodmouse example data provided in the
package ape, which I have been following when trying to solve this issue
(see ?write.nexus.data). When I export the data:

write.nexus.data(data, file="test.nex", interleaved=TRUE,
charsperline=100)

a file is produced which begins:

BEGIN DATA;
   DIMENSIONS NTAX=135165 NCHAR=1;
   FORMAT DATATYPE=DNA MISSING=? GAP=- INTERLEAVE=YES;
   MATRIX
     1           04000000000 etc.

I haven't been able to find other posts on this, any help is greatly
appreciated.

Sincerely,

Nick



_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Reply via email to