[Biopython] SeqIO.write and user-specified wrapping

Ivan Gregoretti ivangreg at gmail.com
Mon Mar 4 18:28:11 UTC 2013


Sorry to pester the list's subscribers but there seems to be bug in FastaWriter

It appears that FastaWriter does not respect the wrap argument:

# No wrapping
SeqIO.FastaIO.FastaWriter( handle, wrap=0 ).write_file( [record] )

or

# wrap after 10 characters
SeqIO.FastaIO.FastaWriter( handle, wrap=10 ).write_file( [record] )

both produce the same output:

>M01483:6:000000000-A2WVJ:1:1101:12685:1873
SVRFQTALASIKLIQASAVLDLTEDDFDFLTSNKVWIATDRSRARRCVEACVYGTLDFVG
YPRFPAPVEFIAAVIAYYVHPVNIQTACLIMEGAEFTENIINGVERPVKAAELFAFTLRV
RAGNTDV
>M01483:6:000000000-A2WVJ:1:1101:19629:2231
LTLADDRLEAFYDNPNALRDYFRDIGRMVLAAEGRKANDSHADCYQYFCVPEYGTANGRL
HFHAVHFMRTLPTGSVDPNFGRRVRNRRQLNSLQNTWPYGYSMP
>M01483:6:000000000-A2WVJ:1:1101:12952:2294
GFENQKELTKMQLDNQKEIAEMQNETQKEIAGIQSATSRQNTKDQVYAQNEMLAYQQKES
TARVASIMENTNLSKQQQVSEIMRQMLTQAQTAGQYFTNDQIKEMTRKVS

FastaWriter does produce an error when I pass wrap="hello world", so,
the argument is interpreted initially. Also, as expected, when I
comment out the SeqIO.FastaIO.FastaWriter line, there is no output.

I checked and double checked.

I am using Python 2.7.3 on a linux 64bit (Fedora 18) and my Biopython is 1.6.1.

Thank you,

Ivan




Ivan Gregoretti, PhD
Bioinformatics



On Mon, Mar 4, 2013 at 12:26 PM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
> On Mon, Mar 4, 2013 at 5:20 PM, Ivan Gregoretti <ivangreg at gmail.com> wrote:
>> I am trying this
>>
>> from Bio import SeqIO
>> SeqIO.FastaIO.FastaWriter( handle, wrap=0 ).write_file( record )
>>
>
> That should be a list of SeqRecord objects, not just one SeqRecord.
> If you have just one, try [record] instead.
>
> Peter



More information about the Biopython mailing list