[BioPython] Need help on NCBIStandaloneblast

Halima Rabiu halima at mancala.cbio.uct.ac.za
Thu Mar 30 07:17:10 UTC 2006


Hi everyboby ;
I am new to biopython having problems with the "NCBIStandalone.blastall".
 After launching the Blast with "doBlast" it look like runs and end
and then I check the output it empty and I try same thing using comand
line it work and get result.
I attch my code.

I also try to go though the previous posts on biopython mailing list fund
similar problem post by Andreas but no solution to the problem .
Please can somebody help
Thanks
Nike
-------------- next part --------------
#! /usr/local/bin/python2.4
#halimah
#20-03-2006
from Bio.Blast import NCBIStandalone
import os
# path to my database
data=os.path.join(os.getcwd(),"Newprotein.db","Nprotein.Fdb")
# input file (protein sequence in fasta )
infile=os.path.join(os.getcwd(),"Newprotein.db","mytest.txt",'r')

# path to Blastall executable
blast_exe=os.path.join("/","usr","local","blast","bin","blastall")

output,error_info =NCBIStandalone.blastall(blast_exe,"blastp", data, infile)
#print output.readline()

save_file =open("blast.out","w")
blast_result=output.read()
save_file.write(blast_result)
save_file.close()
	

blastfile = open('blast.out', 'r')
b_parser = NCBIStandalone.BlastParser()
b_iterator = NCBIStandalone.Iterator(blastfile, b_parser)
while 1:
	b_record = b_iterator.next()
	if b_record is None:
		break
#This will parse the BLAST report into a Blast Record class (either a Blast or a PSIBlast record, depending on what you are parsing) so that you can extract the information from it. In our case, let's just use print out a quick summary of all of the alignments greater than some threshold value.

	E_VALUE_THRESH = 1.00
	for alignment in b_record.alignments:
    		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.expect
            			print hsp.query[0:75] + '...'
            			print hsp.match[0:75] + '...'
            			print hsp.sbjct[0:75] + '...'





More information about the Biopython mailing list