我怎样才能运行ClustalW2没有输入 FASTA 文件?
我可以在命令中添加管道吗?我目前正在关注section 6.2.1在 Biopython Tutorial and Cookbook .
最佳答案
关于使用 Biopython
我假设您希望使用 clustal
包装器 ClustalwCommandLine
。作为包装器,其功能是从实例创建适当的命令行调用。
我认为直接使用命令行工具通常更容易,使用 subprocess
(因此完全跳过 Biopython)。
clustalw2 中的标准输入
咨询clustalw2
documentation ,我看不出有什么办法可以从 stdin
传递数据:
DATA (sequences)
-INFILE=file.ext :input sequences.
-PROFILE1=file.ext and -PROFILE2=file.ext :profiles (old alignment).
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...')
关于python - 在不输入 FASTA 文件的情况下运行 clustalw2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18860962/