[Biopython-dev] FormatIO and SwissProt

Yves Bastide Yves.Bastide at irisa.fr
Wed Jul 2 13:03:29 EDT 2003


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 :)]

 >>> sequence_iterator = SeqRecord.io.readFile(open("SwissProt/sp008"), format="swissprot/40")
 >>> sequence_iterator.next()
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 13, in next
     x = self.obj.next()
   File "/local/lib/python2.2/site-packages/Martel/IterParser.py", line 76, in iterateFile
     self.record_parser.parseString(rec)
   File "/local/lib/python2.2/site-packages/Martel/Parser.py", line 366, in parseString
     self._err_handler.fatalError(result)
   File "/local/lib/python2.2/xml/sax/handler.py", line 38, in fatalError
     raise exception
Martel.Parser.ParserPositionException: error parsing at or beyond character 0



Regards,

yves





More information about the Biopython-dev mailing list