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: Paml

An interface to CODEML, part of the PAML package.

__init__(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.

write_ctl_file()

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(ctl_file)

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

Update each CODEML option to the new option if supplied or None if not supplied. Raise an exception if the control file does not exist, a line is malformed, or an option is invalid.

print_options()

Print out all of the options and their current settings.

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

Run codeml using the current configuration.

Check that the tree file is specified and exists, and then run codeml. If parse is True then read and return the results, otherwise return None. An exception is raised if the return code of the codeml command is non-zero.

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

__annotations__ = {}
Bio.Phylo.PAML.codeml.read(results_file)

Parse a CODEML results file.

Return the results if there are any. Raise an exception if the results file does not exist, is empty, or is invalid.