在 BioPython Phylo 中使用 PhyML

Using PhyML within BioPython Phylo

我最近尝试使用最大似然法从对齐文件创建树,但在遵循官方 BioPython 文档时遇到问题:

cmd = PhymlCommandline(input='data/random.phy')
out_log, err_log = cmd()

我将路径替换为我自己的松散phylip格式文件的路径。 使用 AlignIO 读取我的文件有效,所以路径应该不是问题。

是否需要安装 PhyML 并以某种方式link 将其安装到 BioPython 安装中?

不幸的是,文档对此非常简短。

我在 Windows 上通过 Anaconda 使用 Juypter Notebook。

错误是:

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-4-437a0bc7f21e> in <module>()
  4 cmd = PhymlCommandline(input='C/Users/Nicolas/Documents/Uni/ProjektHerlyn/random.phy', cmd='phyml')
  5 #out_log, err_log = cmd()
----> 6 cmd()

~\Anaconda3\lib\site-packages\Bio\Application\__init__.py in __call__(self, stdin, stdout, stderr, cwd, env)
505                                          universal_newlines=True,
506                                          cwd=cwd, env=env,
--> 507                                          shell=use_shell)
508         # Use .communicate as can get deadlocks with .wait(), see Bug 2804
509         stdout_str, stderr_str = child_process.communicate(stdin)

~\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors)
707                                 c2pread, c2pwrite,
708                                 errread, errwrite,
--> 709                                 restore_signals, start_new_session)
710         except:
711             # Cleanup if the child failed starting.

~\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
995                                          env,
996                                          os.fspath(cwd) if cwd is not None else None,
--> 997                                          startupinfo)
998             finally:
999                 # Child is launched. Close the parent's copy of those pipe

FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden

--> 英文: [WinError 2] 系统找不到给定的文件

简答

  • 从这里下载 PhyML:http://www.atgc-montpellier.fr/phyml/download.php
  • 将适合您的 OS 的可执行文件提取到您的计算机
  • cmd=/your/path/PhyML-3.1_win32.exe' 添加到您的 PhymlCommandline 呼叫中,例如

    cmd = PhymlCommandline(cmd='c:/home/users/nicolas/PhyML-3.1_win32.exe', input='data/random.phy')
    
  • 或者,您可以将可执行文件的路径添加到您的 PATH(见下文)

更长的答案

  • PhymlCommandline 继承了 AbstractCommandline class 这只是可执行文件的包装器
  • 来自文档

Note that by default we assume the underlying tool is installed on the system $PATH environment variable. This is normal under Linux/Unix, but may need to be done manually under Windows. Alternatively, you can specify the full path to the binary as the first argument (cmd):