在没有输入FASTA文件的情况下运行clustalw2

时间:2013-09-17 22:31:28

标签: python biopython fasta clustal

如何在没有输入FASTA文件的情况下运行ClustalW2

我可以在命令中添加管道吗?我目前正在关注section 6.2.1中的Biopython Tutorial and Cookbook

1 个答案:

答案 0 :(得分:2)

使用Biopython

我假设您希望使用clustal包装器ClustalwCommandLine。作为包装器,它的功能是从实例创建适当的命令行调用。

我认为使用subprocess直接使用命令行工具通常更容易(因此完全跳过Biopython)。

stdin in clustalw2

咨询clustalw2 documentation,我认为无法从stdin传递数据:

        DATA (sequences)

-INFILE=file.ext                             :input sequences.
-PROFILE1=file.ext  and  -PROFILE2=file.ext  :profiles (old alignment).

stdin in clustalo

但是,如果升级到Clustal Omega是一个选项,您可以在Clustal Omega documentation中看到可以通过-来表示从stdin获取输入:

SEQUENCE INPUT:

-i, --in, --infile={<file>,-}
    Multiple sequence input file (- for stdin)

请参阅how do I pass a string in subprocess.Popen以供参考,但简而言之:

from subprocess import Popen, PIPE, STDOUT


proc = Popen(['clustalwo', '-', <...>], stdout=PIPE, stdin=PIPE, stderr=STDOUT)
stdout = p.communicate(input='> Seq one\nATCGCTACGCACTACGTACG...')
相关问题