[BioPython] Problem following the Cookbook

Michiel de Hoon mdehoon at c2b2.columbia.edu
Thu Sep 28 14:59:52 UTC 2006


Are you using the latest Biopython release?
 From CVS, it looks like this bug was fixed about two years ago.

--Michiel.

Sebastian Bassi wrote:
> Hello,
> 
> I found en a problem following the BLAST parser tutorial from the
> Biopython cookbook.
> To be in the safe side, I generated a XML output and tried to parse
> that from code extracted from the cookbook.
> Here is the code:
> 
> blast_out = open('blastcasein.xml', 'r')
> from Bio.Blast import NCBIXML
> b_parser = NCBIXML.BlastParser()
> b_record = b_parser.parse(blast_out)
> E_VALUE_THRESH = 0.1
> for alignment in b_record.alignments:
>     for hsp in alignment.hsps:
>         if hsp.expect < E_VALUE_THRESH:
>             print 'length:', alignment.length
>             print 'e value:', hsp.expect
> 
> The error I get is:
> 
> Traceback (most recent call last):
>   File "/home/vicky/GENES/doctorado/nuevo/casein/evalue.py", line 6,
> in -toplevel-
>     b_record = b_parser.parse(blast_out)
>   File "/usr/lib/python2.4/site-packages/Bio/Blast/NCBIXML.py", line
> 111, in parse
>     self._parser.parse(filename)
> NameError: global name 'filename' is not defined
> 
> The path is OK, since both program and data is in the same directory.
> 
> 




More information about the Biopython mailing list