seqinr write.fasta problem with max characters per line
1
0
Entering edit mode
Jonathan ▴ 60
@jonathan-3868
Last seen 10.2 years ago
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
• 2.2k views
ADD COMMENT
0
Entering edit mode
@moshe-olshansky-2329
Last seen 10.2 years ago
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 >
ADD COMMENT
0
Entering edit mode
seqinr is a CRAN package. It is unclear if the authors read this list, please write them directly. There are other functions in R that writes FASTA files, for example writeFATSA in Biostrings. That function breaks lines. Kasper On Wed, Feb 24, 2010 at 1:04 AM, Moshe Olshansky <m_olshansky at="" yahoo.com=""> wrote: > 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 >> > _______________________________________________ > 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 >
ADD REPLY

Login before adding your answer.

Traffic: 743 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6