[BioPython] Problem following the Cookbook

Sebastian Bassi sbassi at gmail.com
Thu Sep 28 14:37:45 UTC 2006


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.


-- 
Bioinformatics news: http://www.bioinformatica.info
Lriser: http://www.linspire.com/lraiser_success.php?serial=318



More information about the Biopython mailing list