Writing fasta files using R package seqinr?

Jennifer Collins picture Jennifer Collins · Aug 6, 2012 · Viewed 11.3k times · Source

When I use write.fasta in seqinr, the file that it outputs looks like this:

>Sequence name 1

>Sequence name 2

>Sequence name 3
...etc

Sequence 1 Sequence 2 Sequence 3 ...etc

In other words, the sequence names are all at the beginning of the file, and then the sequences are output together at the end of the file.

What I'd like to do is this:

>Sequence name 1
Sequence 1
>Sequence name 2
Sequence 2
>Sequence name 3
Sequence 3
...etc

Is that possible with write.fasta?

Answer

Mayela picture Mayela · Oct 9, 2012

I was having a similar problem. What I did was to convert the vector that contained the sequences to a list and it worked fine.

e.g., write.fasta(as.list(seq),names,file)