[Biopython] About BLAST parser

Manu Tamminen mavata at gmail.com
Thu Oct 22 09:45:13 UTC 2009


I have a problem with the Biopython BLAST parser. I'm using the parser  
to extract relevant information from an XML result file into a tab- 
separated table. It seems the XML file occasionally contains errors  
that cause the script to abort. This is especially common and annoying  
with sequence alignments that contain thousands of sequences.

Is it possible to write the script so that when an error occurs, the  
script would jump into the next sequence rather than abort completely?  
I will include below an example of such error. This error is about a  
mismatched tag - sometimes the error has also been about a missing tag.

     for blast_record in blast_records:
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/Bio/Blast/NCBIXML.py", line 660, in parse
     expat_parser.Parse(text, True) # End of XML record
xml.parsers.expat.ExpatError: mismatched tag: line 82921, column 4

Any help appreciated! Thanks!
Manu



More information about the Biopython mailing list