【问题标题】:MuscleCommandline not working in BiopythonMuscleCommandline 在 Biopython 中不起作用
【发布时间】:2017-11-22 00:54:57
【问题描述】:

我需要将我的 python 脚本与肌肉工具集成以进行多序列比对。我按照 Biopython 上的教程进行操作,这是我的代码:

from Bio.Align.Applications import MuscleCommandline
muscle_exe = "muscle.exe"
in_file = "small.fasta"
out_file = "aligned.fasta"
muscle_cline = MuscleCommandline(muscle_exe, input=in_file, out=out_file)

print(muscle_cline)

我正在使用重命名的muscle.exe 文件在正确的文件夹中运行它。但是,python 除了命令之外不输出任何内容,并且未创建文件aligned.fasta。 我看到了老问题,但似乎没有人遇到过这个问题。 Muscle 在正常命令行中工作正常。 谢谢。

【问题讨论】:

    标签: python biopython sequence-alignment


    【解决方案1】:

    manual 在我看来有点令人困惑。 print 不会启动肌肉,而只是打印将要执行的命令。你可以通过调用来锻炼肌肉

    stdout, stderr = muscle_cline()
    

    或者没有 BioPython

    import subprocess
    muscle_result = subprocess.check_output([muscle_exe, "-in", in_file, "-out", out_file])
    

    【讨论】:

    • 谢谢,你知道有没有办法实时查看命令的输出,我的意思是命令是在命令行中启动的
    • 取决于你的意思——你可以告诉 MUSCLE 输出到标准输出,并且使用子进程你可以选择捕获标准输出(这是 Biopython 为你做的)或者让它打印到终端。
    • 另外,如果在 doctest 示例中不包括 stdout, stderr = muscle_cline(),您将如何澄清文档字符串(因为我们在自动化测试框架中使用它)?
    • 你不能让 stdout/stderr 成为函数的一部分,与使用的其他变量不同吗?真的没有办法使用预定义的语言。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-25
    • 1970-01-01
    • 2019-08-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多