[BioPython] BLAST Parser query

kumar s ps_python at yahoo.com
Mon Feb 14 15:28:01 EST 2005


Hi group,
 
I used standalone BLAST to align my sequences to
RefSeq database. 

I followed the sample code given in the cookbook.

Here is my code:



from string import split
from Bio.Blast import NCBIStandalone
b_out = open('xxx_blast.out','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.4
    for alignment in b_record.alignments:
	    for que in b_record.query:
	      for hsp in alignment.hsps:
		if hsp.expect < E_VALUE_THRESH:
                   print '****Alignment****'
		print 'sequence:', alignment.title
	print 'length:', alignment.length
	print 'e value:', hsp.expectprint
	print alignment.query


I want to print my query along with my
alignment.title, because I am blasting 1000 sequences
against RefSeq and I want to know what the query. 


After gawking the class diagram for 40 min. 
I tried this:



while 1:
    b_record = b_iterator.next()

    if b_record is None:
        break

    E_VALUE_THRESH = 0.4
    for alignment in b_record.alignments:
	for que in b_record.query:
	   for hsp in alignment.hsps:
	       if hsp.expect < E_VALUE_THRESH:
		print '****Alignment****'
		print 'sequence:', alignment.title
		print 'length:', alignment.length
		print 'e value:', hsp.expectprint
		print b_record.query


Considering b_record object will have the query
attribute, I incorported in here. It fails. 
Can any one please help printing the query for each
alignment. 

Thank you

K


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail


More information about the BioPython mailing list