Question: Issue with running Codeml using Biopython
0
gravatar for laurenmee17
7 months ago by
laurenmee170 wrote:

Hi there

This is my first post so please be kind if my terminology is incorrect!

I've been trying to run a python script that uses the BioPython module Phylo.Paml to try and automate codeml on a number of alignments.

Here is my script (in progress)

    #!usr/bin/python

import sys
from Bio.Phylo.PAML import codeml

#USAGE python Practice.py aln tree ctrl output

print(sys.argv[1])
cml = codeml.Codeml(alignment = sys.argv[1], 
        tree = sys.argv[2],
        out_file = sys.argv[4],
        working_dir = ".")

cml.run()
ctl_file = sys.argv[3]
verbose = TRUE

Wrote as per direction from the BioPython.Phylo.PAML page (https://biopython.org/wiki/PAML)

This code works when I use it singly but not as I want it to. The console freezes as if the script is running indefinitely and does not stop until I cancel it. When I do I get this error message

Traceback (most recent call last):
  File "Practice2.py", line 14, in <module>
    cml.run()
  File "/home/mee/miniconda3/lib/python3.6/site-packages/Bio/Phylo/PAML/codeml.py", line 182, in run
    Paml.run(self, ctl_file, verbose, command)
  File "/home/mee/miniconda3/lib/python3.6/site-packages/Bio/Phylo/PAML/_paml.py", line 121, in run
    result_code = subprocess.call([command, ctl_file], stdout=dn, stderr=dn)
  File "/home/mee/miniconda3/lib/python3.6/subprocess.py", line 269, in call
    return p.wait(timeout=timeout)
  File "/home/mee/miniconda3/lib/python3.6/subprocess.py", line 1457, in wait
    (pid, sts) = self._try_wait(0)
  File "/home/mee/miniconda3/lib/python3.6/subprocess.py", line 1404, in _try_wait
    (pid, sts) = os.waitpid(self.pid, wait_flags)
KeyboardInterrupt

But when I check my working directory all the output files of the run are waiting there. Similarly, if I cancel the command quickly enough and initiate codeml I am taken to a working screen where codeml is actively running through the files I have input into the script.

Help!

linux codeml biopython python paml • 355 views
ADD COMMENTlink written 7 months ago by laurenmee170

Could you explain a little more what you mean by,

This code works when I use it singly but not as I want it to.

I don't thing your verbose = TRUE line is doing anything FYI. You should be running it as cml.run(verbose=True). Could you do that and post what output you get in that case?

ADD REPLYlink written 7 months ago by jrj.healey13k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1460 users visited in the last hour