Bio.Phylo.PAML.codeml module

Classes for the support of CODEML.

Maximum likelihood analysis using codon substitution models.

exception Bio.Phylo.PAML.codeml.CodemlError

Bases: OSError

CODEML failed. Run with verbose=True to view CODEML’s error message.

class Bio.Phylo.PAML.codeml.Codeml(alignment=None, tree=None, working_dir=None, out_file=None)

Bases: Bio.Phylo.PAML._paml.Paml

An interface to CODEML, part of the PAML package.

__init__(self, alignment=None, tree=None, working_dir=None, out_file=None)

Initialize the codeml instance.

The user may optionally pass in strings specifying the locations of the input alignment and tree files, the working directory and the final output file. Other options found in the CODEML control have typical settings by default to run site class models 0, 1 and 2 on a nucleotide alignment.


Dynamically build a CODEML control file from the options.

The control file is written to the location specified by the ctl_file property of the codeml class.

read_ctl_file(self, ctl_file)

Parse a control file and load the options into the Codeml instance.


Print out all of the options and their current settings.

run(self, ctl_file=None, verbose=False, command='codeml', parse=True)

Run codeml using the current configuration.

If parse is True then read and return the results, otherwise return None.

The arguments may be passed as either absolute or relative paths, despite the fact that CODEML requires relative paths.

Parse a CODEML results file.