[BioPython] NCBIXML - Blast in- and output

Björn Thorwirth bjoern.thorwirth at uni-due.de
Wed Nov 28 12:50:54 UTC 2007


Hi Michiel!

I've filed a bug (#2412) like Peter suggested. 
Am Mittwoch, den 28.11.2007, 20:54 +0900 schrieb Michiel de Hoon:
> Dear Björn,
> 
> Did you look at the Blast output file you are trying to parse?
> It consists of lines like:
I did look at it. It's the Error out, the xml file is just empty.
> 
> blastall] WARNING: 1OR8:E|PDBID|CHAIN|SEQUENCE: Could not calculate 
> ungapped Karlin-Altschul parameters due to an invalid query sequence or 
> its translation. Please verify the query sequence(s) and/or filtering 
> options
> 
> and there is no actual Blast output. So I am not surprised the Blast 
> parser fails...
> 
But shouldn't that beeing catched? And btw. in my first post to the
list, i asked, if I just should catch the Exception. 
in my code i called the NCBIXML like this:
try:
            records=NCBIXML.parse(resultFileHandle)
except Exception,e:
            self.IoErrorHandler(e, resultFileHandle, err_handle)
            raise
...
if records:
      for record in records:
Thats where i got the Exception. For me is it ok.. I've just added an
Exception handler around the "for record"-Loop, and everything is done.
But i thought i schould get the exception by initialization.

Best regrads, and sorry for any inconvenience

Björn
> --Michiel.
> 
> Björn Thorwirth wrote:
> > Hi Michiel!
> > 
> > Thanks for your fast respose! I've used the NCBIXML together with a
> > Twisted server. That's why the backtrace is a bit bloatet.
> > But I guess this are the important lines:
> > 
> > File "/home/user/workspace/PLGDaemon/src/mmCIF/blast_util.py", line
> > 56,
> > in getResults
> >     for record in records:
> >   File
> > "/home/user/Desktop/biopython/biopython-1.43/build/lib.linux-x86_64-2.4/Bio/Blast/NCBIXML.py",
> > line 625, in parse
> >     assert len(blast_parser._records) == 0
> > exceptions.UnboundLocalError: local variable 'blast_parser' referenced
> > before assignment.
> > 
> > Now i was able to backtrace, where the Problem comes from. It may not be
> > related to 32/64 Bit. It happens when Blast's calculation 
> > of the "Karlin-Altschul parameters" fails. This may happen due low
> > complexity of the Query sequence (see Blast FAQ).
> > I've attached a tar with the Blast-output and the reference and input
> > files. I didn't stumble over this problem before on 32 Bit,
> > because that was a smaller Sequenze-DB for testing purposes
> > 
> > Björn




More information about the Biopython mailing list