-1

这是我的代码:

from Bio.Blast import NCBIWWW          
result = NCBIWWW.qblast("blastn","nt",r"C:\Users\video\Documents\sars.fasta")  
save_file = open("blast4.xml", "w")
save_file.write(result.read())
save_file.close()
result.close()
result = open("blast4.xml")
from Bio.Blast import NCBIXML
records = NCBIXML.parse(result)
blast_record = records.__next__()
# Up till here there are no problems 

for alignment in blast_record.alignments:
    for hsp in alignment.hsps:
        if hsp.expect <0.01:
            print('****Alignment****') 
            print('sequence:', alignment.title) 
            print('length:', alignment.length) 
            print('score:', hsp.score) 
            print('gaps:', hsp.gaps) 
            print('e value:', hsp.expect) 
            print(hsp.query[0.90] + '...') 
            print(hsp.match[0.90] + '...') 
            print(hsp.sbjct[0.90] + '...')

代码似乎可以运行,但我没有输出!没有桌子或任何东西。代码只是运行,什么也没有。问题是什么?

4

1 回答 1

0

的价值是len(blast_record.alignments)多少?我不知道您使用的是哪个 sars.fasta 文件,但如果我使用此 sars fasta 文件尝试您的代码,则len(blast_record.alignments)值为0.

所以我假设您的爆炸结果不包含任何对齐,因此不会打印对齐信息。

于 2020-05-05T14:32:00.630 回答