[BioPython] BLASTParser

Suraj Peri suraj_peri at yahoo.com
Wed Jun 18 14:21:41 EDT 2003


Hi group, 
 
 I started learning python recently. I am very much
excited to parse my blast output using biopython
modules. 

I used the code provided in the biopyton tutorial to
parse my blast resutls.
I have a 50 fasta formatted sequences and I blasted
them against RefSeq database locally.  So I used the
Iterator function (please correct me if this is not
correct).

Now I have two problems:

1. I cannot execute my testparser.py script with the
following content:

import os
from Bio.Blast import NCBIStandalone
b_out = open('kinasesrefseqout','r')
b_parser = NCBIStandalone.BlastParser()
b_iterator = NCBIStandalone.Iterator (b_out, b_parser)
b_record = b_iterator.next()

while 1:
         b_record = b_iterator.next()
         if b_record is None:
                 break
         E_VALUE_THRESH = 0.00
         for alignment in b_record.alignments:
                 for hsp in alignment.hsps:
                         if hsp.expect <
E_VALUE_THRESH:
                                 print 'Sequence:',
alignment.title
                                 print 'e value:',
hsp.expect
                                 if len(hsp.query) >
75:
                                         dots = '...'
                                 else:
                                         dots = ''
                                 print hsp.query
[0:75] + dots
                                 print hsp.match
[0:75] + dots
                                 print hsp.sbjct
[0:75] + dots


I get the following error:

Traceback (most recent call last):
  File "ptpparser.py", line 3, in ?
    from Bio.Blast import NCBIStandalone
  File "Bio/__init__.py", line 65, in ?
    _load_registries()
  File "Bio/__init__.py", line 57, in _load_registries
    module = __import__("Bio.config.%s" % module, {},
{}, ["Bio","config"])
  File "Bio/config/DBRegistry.py", line 33, in ?
    from Martel import Parser
  File "Martel/__init__.py", line 6, in ?
    import Expression
  File "Martel/Expression.py", line 33, in ?
    import Parser
  File "Martel/Parser.py", line 33, in ?
    import TextTools
ImportError: No module named TextTools


2. When I try this directly in the interactive mode,
instead of getting a complete list of what I asked it
to 'print', I get the following:

seqience: >ref|NG_001337.1| Homo sapiens T cell
receptor beta variable orphans on chromosome
9(TRBVOR9@) on chromosome 9


Thats it. I expected a list of all sequences with <
0.00 E-Value. I get only one. Simply the iterator
function failed in my case.

Could any one please help me how to get the desired
output. 

Thanks.




=====
PIL/BMB/SDU/DK

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com


More information about the BioPython mailing list