调整缺口惩罚

Adjust Gap Opening Penalty

我正在使用 biopython 包中的 mafft 来比对我的序列:

output=open("aligned.fasta","w")
from Bio.Align.Applications import MafftCommandline
mafft_cline=MafftCommandline(input="test.fasta")
print(mafft_cline)
stdout, stderr = mafft_cline()
output.write(stdout) 

但是我想调整间隙开放惩罚(默认为-6)并且我想测试几个(这里是-1)。帮助页面将其称为 --LOP,但我尝试了多种方法来更改它,但无法更改。

我试过了:

mafft_cline=MafftCommandline(input="test.fasta") --LOP -1

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'LOP' is not defined

mafft_cline.LOP=-1

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Bio/Application/__init__.py", line 410, in __setattr__
    self.set_parameter(name, value)  # treat as a parameter
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Bio/Application/__init__.py", line 358, in set_parameter
    self._check_value(value, name, parameter.checker_function)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Bio/Application/__init__.py", line 380, in _check_value
    % (value, name))
ValueError: Invalid parameter value -1 for parameter LOP

谢谢!

您需要通过对象属性设置参数,例如

mafft_cline.lop = -1.0

请注意,参数值必须是浮点数,即 -1.0 而不是 -1