[BioPython] Running Blast locally

Muthuraman, Manickam manickam.muthuraman at wur.nl
Fri Jun 16 14:52:15 UTC 2006


Dear Christof

Your command also works  separately but my question was how to intergrate blast in biopython script.

in biopython tutorial and cookbook they have the follwoing code where i need to provide the path to database ,file to blast and blast_exe.

I am not clear how to set the path for seq_file,db and exe.

import os
my_blast_db=os.path.join(os.getcwd(),'at-est','a-cds-10-7.fasta')
my_blast_file=os.path.join(os.getcwd(),'at-est','test_blast','sorghum_est-test.fasta')
my_blast_exe=os.path.join(os.getcwd(),'blast','/home/manickam/blast/blastall')


here is the whole script
import os
my_blast_db=os.path.join(os.getcwd(),'at-est','a-cds-10-7.fasta')
my_blast_file=os.path.join(os.getcwd(),'at-est','test_blast','sorghum_est-test.fasta')
my_blast_exe=os.path.join(os.getcwd(),'blast','/home/manickam/blast/blastall')
from Bio.Blast import NCBIStandalone
blast_out,error_info=NCBIStandalone.blastall(my_blast_exe,'blastp',my_blast_db,my_blast_file)
b_parser=NCBIStandalone.BlastParser()
b_iterator=NCBIStandalone.Iterator(blast_out,b_parser)
b_record=b_iterator.next()
while 1:
    b_record=b_iterator.next()
    if b_record is None:
        break
    for alignment in b_record.alignments:
        print "inside 2 loop"
        for hsp in alignment.hsps:
            print "inside 1 loop"
            print 'seq:',alignment.title

it runs but b_record is None so it comes out of the while loop at first time itself. so it mean i am not getting out put of the blast.

from
manickam





More information about the Biopython mailing list