[BioC] seqinr write.fasta problem with max characters per line

Moshe Olshansky m_olshansky at yahoo.com
Wed Feb 24 07:04:54 CET 2010


Hi Jonathan,

I am not an expert on Bioconductor, however I looked at the R code for write.fasta. It uses writeLines function. This function has an argument called sep and it's default value is "\n" (newline character). This is always fine on Unix but on Windows it depends on the application: for some of them "\n" indicates a new line while others also require "\r" (carriage return). I suspect that this is what causing the problem (i.e. your editor may require "\r"). If this is the case, one possibility would be to use another editor. Another possibility is to get the code for write.fasta and slightly modify it (such that it has an additional parameter sep which is passed to writeLines and set it to "\n\r" when calling your "new" write.fasta.

Best regards,
Moshe.

--- On Wed, 24/2/10, Jonathan <jonsleepy at gmail.com> wrote:

> From: Jonathan <jonsleepy at gmail.com>
> Subject: [BioC] seqinr write.fasta problem with max characters per line
> To: bioconductor at stat.math.ethz.ch
> Received: Wednesday, 24 February, 2010, 4:36 PM
> Hi all,
>     Not sure if this is an appropriate question
> to ask of this group,
> but figured better to give it a shot here than at
> R-help...
> 
> 
> I'm trying to write DNA sequences to a file in fasta
> format.  the
> seqinr library has a function called write.fasta, which
> works fine,
> except for one crucial point:
> there's supposed to be a maximum number of characters per
> line (the
> default is supposed to be 60), but when I call the
> function, it simply
> prints the entire sequence on a single line, regardless of
> how long it
> is (in every case, the sequence is longer than the value
> used for the
> nbchar argument)...
> 
> Anybody else experiencing this or have a solution?
> 
> I'm using Windows 7 64-bit, R version 2.10.1.
> 
> Regards,
> Jonathan
> 
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>


More information about the Bioconductor mailing list