[BioPython] Problems runing BLAST
Bruno Santos
bsantos at biocant.pt
Tue Jan 29 11:34:07 UTC 2008
I am once more having problems running blast using biopython. I start the
script the blastall process starts and after a few minutes it starts
sleeping and no error message is passed. When I check the xml file it only
writes part of the results for the first sequence.
Does anyone has ever had the same problem?
I'm using:
python 2.5.1
biopython 1.44
blastall 2.2.16
My code is the following:
from Bio import SeqIO
from Bio.Blast import NCBIStandalone
from Bio.Blast import NCBIXML
import time
import math
import time
import os
primer = 'D2'
sample = 'AGC'
#Defines all the databases that will be used
my_blast_db = ('\"/home/bsantos/DataBases/nt.00
/home/bsantos/DataBases/nt.01 /home/bsantos/DataBases/nt.02
/home/bsantos/DataBases/nt.03 /home/bsantos/DataBases/nt.04
/home/bsantos/DataBases/nt.05 /home/bsantos/DataBases/RDPIIdb
/home/bsantos/DataBases/RNADB\"')
print my_blast_db
#Define the fasta file to Blast
destination = '/home/bsantos/Metagenomics/Results/' + sample + '/' + primer
+ '/filteredfile_sample' + sample + '_' + primer + '_F.fasta'
my_blast_file = (destination)
#Defines the blast binaries
my_blast_exe = "/usr/local/bin/blastall"
print (os.path.exists(my_blast_exe))
print time.ctime()
#Performs Blast
print 'Now Performing Blast'
result_handle, error_info = NCBIStandalone.blastall(my_blast_exe,
"blastn",my_blast_db, my_blast_file)
print 'This errors have occured:'
print error_info.read()
print 'Starting parsing the results.......'
#Parse the result of the blast in XML format
blast_results = result_handle.read() #Catch the results
save_file = open('/home/bsantos/Metagenomics/Results/' + sample + '/' +
primer + '/BlastReport_sample' + sample + '_' + primer + '_F.xml', 'w')
save_file.write(blast_results) #Write all the information to an XML file
save_file.flush()
save_file.close()
More information about the Biopython
mailing list