运行 使用 biopython 进行序列比对

Running sequence alignment using biopython

我对来自 biopython 的 运行 mafft 很感兴趣。它工作正常(下面的代码)。

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

但我想在第一个序列(参考序列)的基础上添加调整序列方向的附加参数。在文档中,我发现它被写下来了,但我不确定如何将它合并到我上面的代码中:

Mafft V6 测试版功能

_Switch(["--adjustdirection", "adjustdirection"], 
"Adjust direction according to the first sequence. " 
"Default off."), 
# Adjust direction according to the first sequence 
# for highly diverged data; very slow 
# Mafft V6 beta function 
_Switch(["--adjustdirectionaccurately", "adjustdirectionaccurately"], 
"Adjust direction according to the first sequence," 
"for highly diverged data; very slow" 
"Default off."), 

我尝试了一些事情,比如 mafft_cline=MafftCommandline(输入="file.fasta", --adjustdirection) 但返回时出现错误。

谢谢!

您可以通过设置 mafft_clineadjustdirection 属性 来实现。默认情况下,它是 False.

>> from Bio.Align.Applications import MafftCommandline
>> mafft_cline = MafftCommandline(input="file.fasta")
>> print(mafft_cline.adjustdirection)
False
>> mafft_cline.adjustdirection = True

我们现在看到 --adjustdirection 开关已添加到命令行。

>> print(mafft_cline)
mafft --adjustdirection file.fasta