【问题标题】:ValueError file not found after setting output - Biopython设置输出后找不到 ValueError 文件 - Biopython
【发布时间】: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


【解决方案1】:

您似乎已经发现,参数outputfmt 需要更正为outfmt。但是,这里似乎还有一些问题:

A.) 看来您正试图将两个核苷酸 fasta 文件相互攻击? 首先,您需要使用makeblastdb 为您的参考序列创建一个blast 数据库。那么你就可以对这个数据库进行快速查询了

B.)您似乎正在尝试使用 blastp(用于蛋白质序列)来针对核苷酸参考爆炸核苷酸序列。如果 blastp 找到一个核苷酸数据库而不是蛋白质数据库,它会尝试找到一个引用相应蛋白质序列的别名文件(因此您在 cmets 中出现错误)。确保您选择了正确的爆破工具:

  • blastn:用于针对核苷酸参考的核苷酸查询
  • blastp:针对蛋白质参考进行蛋白质查询
  • blastx:用于针对蛋白质参考的核苷酸查询
  • tblastn:用于针对核苷酸参考的蛋白质查询

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-09-09
    • 2017-02-21
    • 1970-01-01
    • 2020-10-21
    • 1970-01-01
    • 2014-03-19
    • 1970-01-01
    • 2011-03-07
    相关资源
    最近更新 更多