问题
from Bio.Blast import NCBIXML
from Bio.Blast import NCBIWWW
result_handle = NCBIWWW.qblast(
"blastn",
"nr",
"CACTTATTTAGTTAGCTTGCAACCCTGGATTTTTGTTTACTGGAGAGGCC",
entrez_query='"Beutenbergia cavernae DSM 12333" [Organism]')
blast_records = NCBIXML.parse(result_handle)
for blast_record in blast_records:
for alignment in blast_record.alignments:
for hsp in alignment.hsps:
print(hsp.query[0:75] + '...')
print(hsp.match[0:75] + '...')
print(hsp.sbjct[0:75] + '...')
this does not give me an output, although the sequence is actually a sequence of the genome, so i must get a result. where is the error? the query is correct?
回答1:
Your query isn't returning any results. The default parameters for blast are the cause. These parameters work better in this particular case of small length queries:
result_handle = NCBIWWW.qblast(
"blastn",
"nr",
"CACTTATTTAGTTAGCTTGCAACCCTGGATTTTTGTTTACTGGAGAGGCC",
megablast=False,
expect=1000,
word_size=7,
nucl_reward=1,
nucl_penalty=-3,
gapcosts="5 2",
entrez_query='Beutenbergia cavernae DSM 12333 [Organism]')
Particularly the expect
parameter plays a major role here.
来源:https://stackoverflow.com/questions/24695028/blast-against-genomes-in-biopython