[Biopython] Write FASTA sequence on a single line
Willis, Jordan R
jordan.r.willis at Vanderbilt.Edu
Sun Mar 4 18:35:58 UTC 2012
I don't think there is an option, but you could possibly write it in the SeqIO class.
I have to do this all the time and i just write it to a file manually
for _record in SeqIO.parse(fastah,'fasta)
open(outputfile,'a').write(">"+_record.id+record.seq)
You can of course format these to output to a file anyway you want.
Jordan
On Mar 4, 2012, at 12:09 PM, Martin Mokrejs wrote:
> Hi,
> is there an option to tell FASTA writer to write output with a
> sequence on a single line (so that a FASTA entry would span just
> two lines altogether)? I see it should be faster to eventually
> parse using SeqIO because one would avoid calls for each line in
> the FASTAinput file.
>
> In my code I have
> for _record in SeqIO.parse(fastah, 'fasta'):
>
> which boils down to biopython's:
> append(line.rstrip().replace(" ","").replace("\r",""))
>
> per every line with _sequence_.
>
> Thank you for comments,
> Martin
>
>
>
> _______________________________________________
> Biopython mailing list - Biopython at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython
>
More information about the Biopython
mailing list