【发布时间】:2020-10-23 02:24:03
【问题描述】:
from Bio.Blast.Applications import NcbiblastpCommandline
blastp_cline = NcbiblastpCommandline(cmd="~ncbi-blast.2.10.1+bin/blastp", query="human.fa", db="mouse.fa", evalue=.0001, out="output.xml", outputfmt=5)
blastp_cline
from Bio.Blast import NCBIXML
result_handle = open(homoutput.xml)
blast_records - NCBIXML.parse(results_handle)
for br in blast_records:
for alignments in br.alignments:
for hsp in alignments.hsps:
if hsp.expect < 1e-107:
print (alignments.title)
print (alignments.length)
print (hsp.expect)
print (hsp.query)
print (hsp.match)
这是我得到的全部错误:
Traceback (most recent call last):
File "parseBlast.py", line 5, in <module>
blastp_cline = NcbiblastpCommandline(cmd="~ncbi-blast.2.10.1+bin/blastp", query="human.fa", db="mouse.fa", evalue=.0001, out="output.xml", outputfmt=5)
File "/home/minhlam/.local/lib/python3.8/site-packages/Bio/Blast/Applications.py", line 512, in __init__
_NcbiblastMain2SeqCommandline.__init__(self, cmd, **kwargs)
File "/home/minhlam/.local/lib/python3.8/site-packages/Bio/Blast/Applications.py", line 438, in __init__
_Ncbiblast2SeqCommandline.__init__(self, cmd, **kwargs)
File "/home/minhlam/.local/lib/python3.8/site-packages/Bio/Blast/Applications.py", line 392, in __init__
_NcbiblastCommandline.__init__(self, cmd, **kwargs)
File "/home/minhlam/.local/lib/python3.8/site-packages/Bio/Blast/Applications.py", line 308, in __init__
_NcbibaseblastCommandline.__init__(self, cmd, **kwargs)
File "/home/minhlam/.local/lib/python3.8/site-packages/Bio/Blast/Applications.py", line 115, in __init__
AbstractCommandline.__init__(self, cmd, **kwargs)
File "/home/minhlam/.local/lib/python3.8/site-packages/Bio/Application/__init__.py", line 295, in __init__
self.set_parameter(key, value)
File "/home/minhlam/.local/lib/python3.8/site-packages/Bio/Application/__init__.py", line 410, in set_parameter
raise ValueError("Option name %s was not found." % name)
**ValueError: Option name outputfmt was not found.**
我正在检查我的目录,但没有输出,所以第二个爆炸部分甚至不起作用。我正在使用 2 个本地文件:human.fa 和 mouse.fa。我假设使用 Blast 解析 human.fa 以在 mouse.fa 数据库中查找同源物,并打印出人类序列 ID、鼠标 ID、相似同源物和相应的比对。
【问题讨论】:
-
听起来
outputfmt不是NcbiblastpCommandline()的有效参数。你为什么用它? -
哦,对于 xml,它的 outfmt=5。我更改了它但仍然错误输出文件未生成,因此 NameError: name 'output' is not defined。命令行的第一部分根本不生成 xml 文件
-
from Bio.Blast.Applications import NcbiblastpCommandline blastp_cline = NcbiblastpCommandline(cmd="~/ncbi-blast-2.10.1+/bin/blastp", query="human.fa", db="mouse.fa", evalue=.0001, out="output.xml", outfmt=5) blastp_cline()将我的第一个模块更改为此。但现在我遇到了一个我不认识的错误,或者谷歌没有帮助: -
raise ApplicationError(return_code, str(self), stdout_str, stderr_str) Bio.Application.ApplicationError: 来自 '~/ncbi-blast-2.10.1+/bin/blastp 的非零返回码 2 -out output.xml -outfmt 5 -query human.fa -db mouse.fa -evalue 0.0001', message 'BLAST Database error: No alias or index file found for protein database [mouse.fa] in search path [/home/ minhlam::]'
-
@minjah:这是您在尝试针对核苷酸数据库爆破蛋白质序列时遇到的典型错误。 Blastp 仅用于针对 PROTEIN 数据库对 PROTEIN 序列进行爆破。确保你有正确的程序(blastp 或 blastn)正确的输入和正确的数据库
标签: python parsing biopython blast