Biopython错误 - 系统找不到指定文件

1 投票
1 回答
1524 浏览
提问于 2025-04-17 10:37

我遇到了一个错误,自己解决不了。

我想执行一组最简单的命令,使用tBLASTn算法,在一个数据库中查找一个序列(这个序列是一个名为“pytanie.fasta”的文件),数据库也是一个文件,叫做“cucumber.fasta”。结果会保存在“wynik.txt”这个文件里。

我的代码是这样的:

from Bio.Blast. Applications import NcbitblastnCommandline
database = r"\Biopython\cucumber.fasta"
qr = r"\Biopython\pytanie.fasta"
output = r"\Biopython\wynik.txt"
e = raw_input("Enter e-value: ")
tblastn_cline = NcbitblastnCommandline(cmd='blastn', db=database, query=qr, out=output, evalue=e, outfmt=7)

print tblastn_cline

stdout, stderr = tblastn_cline()

然后我遇到的错误是:

 File "C:\Users\IBM_ADMIN\Desktop\PYTHON\Workspace\Biopython\blast.py", line 20, in <module>
stdout, stderr = tblastn_cline()
File "C:\Python27\lib\site-packages\Bio\Application\__init__.py", line 435, in __call__
shell=(sys.platform!="win32"))
File "C:\Python27\lib\subprocess.py", line 679, in __init__
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 893, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

我使用的是:

  • Eclipse SDK版本:3.7.1
  • Python版本:2.7
  • 操作系统:64位Windows 7

我也在32位的Windows XP上试过,结果也是同样的错误。Biopython这个包应该没问题,因为它通过了biopython网站推荐的测试。我还尝试了不同的文件路径格式,但都不行。我的朋友在Ubuntu上用同样的代码运行得很好。

有没有人知道怎么解决这个错误?

1 个回答

0

文件的路径是什么?

比如说,路径 r"\Biopython\cucumber.fasta" 是当前驱动器上的一个绝对路径(因为它是以反斜杠开头的,并且没有驱动器字母),我觉得在你的情况下,它应该是 r"C:\Biopython\cucumber.fasta"。这样理解对吗?

撰写回答