使用biopython运行序列比对

时间:2017-05-22 21:29:36

标签: bioinformatics 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 beta功能

_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(input =“file.fasta”, - adjustdirection) 但它又出现了错误。

谢谢!

1 个答案:

答案 0 :(得分:0)

您可以通过设置adjustdirection的{​​{1}}属性来执行此操作。默认情况下,它是mafft_cline

False

我们现在看到>> from Bio.Align.Applications import MafftCommandline >> mafft_cline = MafftCommandline(input="file.fasta") >> print(mafft_cline.adjustdirection) False >> mafft_cline.adjustdirection = True 开关已添加到命令行。

--adjustdirection