[BioPython] BLAST XML parser trouble

B. Brazelton bbrazelton at gmail.com
Tue Oct 9 00:33:03 UTC 2007


I tried to follow the BLAST XML parser example in the tutorial, but I
always get the following error when attempting to iterate through the
records:

Traceback (most recent call last):
  File "BlastXML_Parser.py", line 10, in ?
    for blast_record in blast_records:
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/Bio/Blast/NCBIXML.py",
line 572, in parse
    expat_parser.Parse(text, False)
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/Bio/Blast/NCBIXML.py",
line 98, in endElement
    eval("self.%s()" % method)
  File "<string>", line 0, in ?
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/Bio/Blast/NCBIXML.py",
line 215, in _end_BlastOutput_version
    self._header.version = self._value.split()[1]
IndexError: list index out of range

All I did was:

result_handle = open('NifH_Blast.xml')
from Bio.Blast import NCBIXML
blast_records = NCBIXML.parse(result_handle)
for blast_record in blast_records:
    ... etc

I put my script and xml file here:
http://www.staff.washington.edu/braz/files

I'm using biopython 1.43, and I get the same error on both Python
2.3.5 and Python 5.

It seems like my commands are exactly what is in the tutorial, so I'm
confused. My best guess is that there is a difference in the XML
format, but it's NCBI XML. Thanks for any help,

Bill Brazelton



More information about the Biopython mailing list