Re: [R-sig-phylo] problem with write.nexus.data

2014-09-24 Thread Emmanuel Paradis

Hi Liam and Nicholas.

write.nexus.data() accepts only lists as specified in the help page, but 
it's a bit of an anomaly since the same help page says the sequences 
must be aligned. I have modified this function so that it now accepts 
both lists and matrices.


Best,

Emmanuel

Le 18/09/2014 07:22, Liam J. Revell a écrit :

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   040 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/



___
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/


Re: [R-sig-phylo] problem with write.nexus.data

2014-09-18 Thread Nicholas Crouch
This solved the problem exactly, thank you very much.

Nick

On Thu, Sep 18, 2014 at 12:22 AM, Liam J. Revell 
wrote:

> 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   040 etc.
>>
>> I haven't been able to find other posts on this, any help is greatly
>> appreciated.
>>
>> Sincerely,
>>
>> Nick
>>
>>
>>


-- 
Nicholas Crouch
Graduate Student, Igić Lab
Department of Biological Sciences
University of Illinois at Chicago

[[alternative HTML version deleted]]

___
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/

Re: [R-sig-phylo] problem with write.nexus.data

2014-09-17 Thread Liam J. Revell

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   040 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/