我试图通过BLAST解析几十个序列,使用生物。爆炸在Python2.7中使用NCBIWWW。一个或几个序列没有问题,但是NCBIWWW.qblast()总是在大约5-7次迭代的BLAST搜索之后停止。重要的是,程序不会崩溃并带错误退出-它只是暂停,并永远冻结。我必须手动退出应用程序。这也不是互联网连接的问题,没有错误可以说明这一点。在
我不知道怎么了。我的代码中是否存在阻止多次BLAST搜索的错误,或者是否有其他的算法可以用于此目的?在
我的代码:
from Bio.Blast import NCBIWWW
import urllib
def load_uniprot_fasta(identifier): #loads fasta file for a given UniProt identifier
link = "http://www.uniprot.org/uniprot/" + identifier + ".fasta"
f = urllib.urlopen(link)
content = f.read()
print content
print "\n"
new_file = open(str(identifier)+".seq", "w")
new_file.write(content)
evalue = 0.00001
id_list = open("list.list", "r") #this file is a list of UniProt identifiers, every line is a new identifier
for line in id_list:
uniprot_id = ""
uniprot_id = str(line).strip("\n")
load_uniprot_fasta(uniprot_id) #creates a <uniprot_id>.fasta file
fasta_object = open(str(uniprot_id)+".seq").read()
result_handle = NCBIWWW.qblast("blastp", "swissprot", fasta_object)
print "SUCCESS\n"
我看不出你的代码有任何故意的延迟你读过NCBI BLAST Usage Guidlines:
尽管
NCBIWWW
有一个延迟机制来确定它检查查询结果的频率,但我看不出它在查询之间增加了延迟。我不是说这绝对是你的问题,但你可能不在NCBI的指导范围之内。关于这个问题,我看到了另一条建议:相关问题 更多 >
编程相关推荐