python - NCBIblastP 命令行错误

标签 python python-3.x bioinformatics biopython blast

我正在尝试自动从目录中的多个文件进行爆炸输出。这里的变量是硬编码的,但稍后将由用户定义。我的内文件将通过循环更改,但我在 python 内的文件上运行 NcbiblastpCommandline 时遇到问题。旨在使用多批较大的 fasta 文件的输入在本地运行blast,因此blast将按顺序运行每个批处理文件,输出到tsv中,我在tsv中解析数据并传递给clustalw本地对齐。

Input_file="minifasta.fasta"
data="uniprot_database"
E_Value_Thresh=1e-10
counter=1
Filename2= 'Batch'+str(counter)
from Bio.Blast.Applications import NcbiblastpCommandline
blast_output_file='blastout.tsv'
NcbiblastpCommandline.outfile=Filename2
from Bio.Blast.Applications import NcbiblastpCommandline
cline = NcbiblastpCommandline(query=Input_file, db=data,outfmt=6, 
out=blast_output_file, evalue= E_Value_Thresh)
print(cline)
stdt, stdr= cline()

我不断收到错误消息“NcbiblastpCommandline”对象不可迭代。我被定向到 stdt、stdr 行,但没有 stdt、stdr 时会出现另一个错误,指出该命令无法识别,并且错误消息定向到 stdout_str、stderr_str。我找不到 Python 3 中 NcbiblastpCommandline 用法的最新示例来指导我。

我收到的完整错误是:

ApplicationError: Non-zero return code 127 from 'blastp -out blastout.tsv -outfmt 6 -query minifasta.fasta -db uniprot_database -evalue 1e-10', message '/bin/sh: blastp: command not found'.

  File "/Users/me/anaconda3/lib/python3.6/site-packages/Bio/Application/__init__.py", line 523, in __call__
    stdout_str, stderr_str)

最佳答案

首先运行 whichblastp 以查找 blastp 的完整路径,并将其作为参数提供给 NcbiblastpCommandline

from Bio.Blast.Applications import NcbiblastpCommandline
blastp_path = '/path/to/blastp'
cline = NcbiblastpCommandline(cmd=blastp_path, query=Input_file, db=data,outfmt=6, 
out=blast_output_file, evalue= E_Value_Thresh)

如果您现在执行print(cline),它应该打印出将要运行的完整命令。通过复制/粘贴此输出并从命令行运行它来仔细检查这是否有效。

关于python - NCBIblastP 命令行错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50059372/

相关文章:

python - 'BooleanField' 对象在 Django 中没有属性 'use_required_attribute'

python - 生物格式-Python 错误 : 'ascii' codec can't encode character u'\xb5' when using OMEXML()

python-3.x - 如何解决 cv2.error : (-215)?

python - BioPython:氨基酸序列包含 'J',无法计算分子量

c++ - 计算两个 _m128i SIMD vector 之间的匹配字节数

python - 运行matplotlib绘图标签,然后显示错误框

python - 在 python 中使用 iloc 和函数

python - ODBC中的错误,但Hive的CLI中没有错误?

python - 从过滤器返回第一个元素或无

python - Tornado : support multiple Applications when using multi-process?(注意:多个应用程序)