I am trying to run online ncbi blast on python.
from Bio.Blast import NCBIWWW
from Bio.Blast import NCBIXML
from Bio import SeqIO
record = SeqIO.read(r"C:\Users\loops\Downloads\biopy_resources\Section1\Chap8\buccal_swab.unmapped1.fasta",format="fasta")
handle = NCBIWWW.qblast("blastn","nt",record.seq)
blast_records = NCBIXML.parse(handle)
E_VALUE_THRESH = 0.0001
for blast_record in blast_records:
for alignment in blast_record.alignments:
for hsp in alignment.hsps:
if hsp.expect < E_VALUE_THRESH:
print(alignment.title)
print(alignment.length)
print(hsp.expect)
print(hsp.query[0:75])
print(hsp.match[0:75])
print(hsp.sbjct[0:75])
reading fasta file succeeded, but no results are displayed. I think it's stuck here: handle = NCBIWWW.qblast("blastn","nt",record.seq)
from Bio.Blast import NCBIWWW
handle = NCBIWWW.qblast("blastn","nt","8332116")
it does not work,either.
if there is no error, maybe there is not result because the e-value if above the threshold? you could disable the if condition OR might relate to this problem of running slow within python eventually: NCBIWWW.qblast parsing xml files