[Biopython-dev] FormatIO and SwissProt

Yves Bastide Yves.Bastide at irisa.fr
Thu Jul 3 05:43:28 EDT 2003


Jeffrey Chang wrote:
> On Wednesday, July 2, 2003, at 10:03  AM, Yves Bastide wrote:
> 
>> Hi,
>>
>> FormatIO doesn't seem to handle SwissProt files well...
>>
>> bionix:~/src/bio/biopython/Tests% python
>> Python 2.2.2 (#1, Feb 14 2003, 12:23:31)
>> [GCC 3.2 20020903 (Red Hat Linux 8.0 3.2-7)] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>>
>>>>> from Bio import SeqRecord
>>>>> sequence_iterator = SeqRecord.io.readFile(open("SwissProt/sp008"))
>>
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in ?
>>   File  "/.amd/archipel/export/archive/d08/symbiose/ybastide/src/bio/ 
>> biopython/build/lib.linux-i686-2.2/Bio/FormatIO.py", line 97, in  
>> readFile
>>     raise TypeError("Could not determine file type")
>> TypeError: Could not determine file type
>>
>> [OK, there are two Swissprot parsers.  Erm, why  
>> */build/lib-*/Bio/FormatIO.py?
>> It's certainly not in my path :)]
> 
> 
> Is this related to the patch you sent in?  This also fails on my  
> system, but the path points to my usual python path (i.e. not  
> ../build...).

Strange.  No, don't see how it could be because of my patch: I didn't 
use run_test nor play with sys.path

> 
> And yes, you've hit the problem right on the nose.  There are two  
> Swiss-Prot parsers.  The FormatIO one is still considered experimental,  
> and is not maintained as well.  I'd recommend using the  
> Bio/SwissProt/SProt parser instead.

There are three SP parsers: Bio/SwissProt/SProt and two for FormatIO 
(../Bio/expressions/swissprot/sprot{38,40}.py)

I'd like to use FormatIO because

1. It's cool to use the same code whether I'm accessing nr or sprot or 
something else

2. Bio.SeqRecord: to insert into a database.  One can't get a 
Bio.SeqRecord from SProt, I think


About GenBank:
GenBank.FeatureParser uses a nice Martel parser, FormatIO an 
experimental-unmaintened one; couldn't FormatIO use the good one? (OTOH 
Bio.SwissProt.SProt is not Martel-based)

> 
> Jeff

yves




More information about the Biopython-dev mailing list