[Biopython] some problem parsing swissprot format

Michael Thon mike.thon at gmail.com
Tue Jun 2 11:11:07 UTC 2015


Hi Peter - I finally got back to work on this. I installed biopython 1.65 in a virtualenv and my script works fine now. My previous version was 1.64. I could probably hunt down the record that breaks my script  if you think you need it for a test case.
Mike



> On May 29, 2015, at 12:58 PM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
> 
> On Fri, May 29, 2015 at 11:24 AM, Michael Thon <mike.thon at gmail.com> wrote:
>> I downloaded a set of proteins from uniprot in 'text' format. I am parsing the file with this:
>> 
>> in_file = SeqIO.parse(file_h, "swiss")
>> 
>> but I ran into this error:
>> 
>> Traceback (most recent call last):
>>  File "prep_blast_db.py", line 19, in <module>
>>    for item in in_file:
>>  File "/Library/Python/2.7/site-packages/Bio/SeqIO/__init__.py", line 586, in parse
>>    for r in i:
>>  File "/Library/Python/2.7/site-packages/Bio/SeqIO/SwissIO.py", line 81, in SwissIterator
>>    for swiss_record in swiss_records:
>>  File "/Library/Python/2.7/site-packages/Bio/SwissProt/__init__.py", line 117, in parse
>>    record = _read(handle)
>>  File "/Library/Python/2.7/site-packages/Bio/SwissProt/__init__.py", line 184, in _read
>>    _read_rn(reference, value)
>>  File "/Library/Python/2.7/site-packages/Bio/SwissProt/__init__.py", line 409, in _read_rn
>>    assert rn[0] == '[' and rn[-1] == ']', "Missing brackets %s" % rn
>> AssertionError: Missing brackets [1] {ECO:0000305, ECO:0000312|EMBL:BAC84995.1}
>> 
>> Maybe swissprot format has changed?
> 
> Hi Michael,
> 
> Yes, the format did change - but it sounds like something which should
> already be fixed in Biopython 1.65,
> 
> https://github.com/biopython/biopython/issues/513
> https://github.com/biopython/biopython/issues/369
> 
> Which version of Biopython are you using, and can you update it?
> 
> Which record from UniProt causes this problem (so we can test it)?
> 
> Thanks,
> 
> Peter




More information about the Biopython mailing list