[BioPython] Parsing genbank problem

Sebastian Bassi sbassi at asalup.org
Fri Mar 19 12:06:18 EST 2004


Hello,

I've been trying to parse a gb file to no avail.
Here is my code (extracted from biopython cookbook)

from Bio import GenBank
from Bio.Seq import MutableSeq
from Bio.Alphabet import IUPAC
from Bio import utils

gb_handle = open("f:\\download\\ors.gbk","r")
feature_parser=GenBank.FeatureParser()
iterator = GenBank.Iterator(gb_handle, feature_parser)
while 1:
     cur_entry=iterator.next()
     if cur_entry is None:
         break
     print "test", cur_entry.id
gb_handle.close()


In ors.gbk file there are lots of genbank entries (don't post it here 
because is 800Kb long).
Here is what I get:

Traceback (most recent call last):
   File "C:/Program Files/Python22/parseGB.py", line 13, in ?
     cur_entry=iterator.next()
   File 
"C:\PROGRA~1\Python22\Lib\site-packages\Bio\GenBank\__init__.py", line 
183, in next
     return self._parser.parse(File.StringHandle(data))
   File 
"C:\PROGRA~1\Python22\Lib\site-packages\Bio\GenBank\__init__.py", line 
268, in parse
     self._scanner.feed(handle, self._consumer)
   File 
"C:\PROGRA~1\Python22\Lib\site-packages\Bio\GenBank\__init__.py", line 
1255, in feed
     self._parser.parseFile(handle)
   File "C:\PROGRA~1\Python22\Lib\site-packages\Martel\Parser.py", line 
338, in parseFile
     self.parseString(fileobj.read())
   File "C:\PROGRA~1\Python22\Lib\site-packages\Martel\Parser.py", line 
366, in parseString
     self._err_handler.fatalError(result)
   File 
"C:\PROGRA~1\Python22\Lib\site-packages\_xmlplus\sax\handler.py", line 
38, in fatalError
     raise exception
ParserPositionException: error parsing at or beyond character 1496




More information about the BioPython mailing list