我有以下功能,几个月来一直很好用.我没有更新我的Python版本(除非它发生在幕后?).
def Blast(type, protein_sequence, start, end, genomic_sequence):
result = []
M = re.search('M', protein_sequence)
if M:
query = protein_sequence[M.start():]
temp = open("temp.ORF", "w")
print >>temp, '>blasting'
print >>temp, query
temp.close()
cline = blastp(query="'temp.ORF'", db="DB.blast.txt",
evalue=0.01, outfmt=5, out=type + ".BLAST")
os.system(str(cline))
blast_out = open(type + ".BLAST")
string = str(blast_out.read())
DEF = re.search("<Hit_def>((E|L)\d)</Hit_def>", string)
Run Code Online (Sandbox Code Playgroud)
我收到blast_out=open(type+".BLAST")无法找到指定文件的错误.此文件作为os.system调用调用的程序输出的一部分创建.这通常需要大约30秒才能完成.但是,当我尝试运行程序时,它立即给出了我上面提到的错误.
我以为os.system()应该等待完成?
我应该以某种方式强迫等待吗?(我不想硬编码等待时间).
编辑:我已经在BLAST程序的命令行版本中运行了cline输出.一切似乎都很好.