Out of date as of Feb 22. This will be updated soon...
Methods
build_ctl_file(self)
Dynamically build a CODEML control file from the options.
get_all_options(self)
Return the values of all the options.
get_option(self, option)
Return the currently set value of a CODEML option.
help(self, option)
Print documentation about an option.
parse_results(self, results_file)
Parse a CODEML results file and store the various statistics of
interest in the codeml object.
print_options(self)
Print out all of the options and their current settings.
run(self, verbose=False)
Run codeml using the current configuration and then parse the
results. Returns a process signal so the user can determine if
the execution was successful (return code 0 is successful, -N
indicates a failure).
set_option(self, option, value)
Set the value of an option. This function abstracts the options
dict to prevent the user from adding options that do not exist
or misspelling options.
Properties
Note: all file/directory locations may be absolute or relative paths (PAML programs normally require relative paths)
working_dir:
The directory where CODEML will process and output files
alignment:
The location of the alignment file
tree:
The location of the tree file
out_file:
The location to write the main output file
ctl_file:
The location to write the control file
results:
A dict containing results that have been parsed by the codeml object
Example
In [1]: from pypaml import codeml
In [2]: cml = codeml.codeml()
In [3]: cml.print_options()
verbose = 0
CodonFreq = 2
cleandata = 1
fix_blength = None
NSsites = 0 1 2
fix_omega = 0
clock = 0
ncatG = None
runmode = 0
fix_kappa = 0
fix_alpha = 1
Small_Diff = None
method = 0
Malpha = 0
aaDist = None
RateAncestor = 0
aaRatefile = None
icode = 0
seqtype = 1
omega = 1
getSE = 0
noisy = 0
Mgene = 0
kappa = 4.54006
model = 0
ndata = None
In [4]: cml.help("NSsites")
Specifies the site models, with NSsites = m corresponds to model Mm
in Yang et al. (2000b). The variable ncatG is used to specify the
number of categories in the ω distribution under some models. In
Yang et al. (2000b), this is 3 for M3 (discrete), 5 for M4 (freq),
10 for the continuous distributions (M5: gamma, M6: 2gamma,
M7: beta, M8:beta&w, M9:beta&gamma, M10: beta&gamma+1,
M11:beta&normal>1, and M12:0&2normal>1, M13:3normal>0). For example,
M8 has 11 site classes (10 from the beta distribution plus 1
additional class for positive selection with ωs ≥ 1). See the
section Codon substitution models above about the changes to M1 and
M2 introduced in PAML version 3.14.
You can run several Nssites models in one batch, as follows, in
which case the default values of ncatG, as in Yang et al. (2000b),
are used.
NSsites = [0, 1, 2, 3, 7, 8]
The posterior probabilities for site classes as well as the expected
ω values for sites are listed in the file rst, which may be useful
to identify sites under positive selection.
---
0:one w; 1:neutral; 2:selection; 3:discrete; 4:freqs;
5:gamma; 6:2gamma; 7:beta; 8:beta&w; 9:betaγ
10:beta&gamma+1; 11:beta&normal>1; 12:0&2normal>1;
13:3normal>0
**NOTE**: Unlike in the CODEML control file, you must enter
NSsites as a Python array of integers as illustrated
above.
In [5]: cml.set_option("NSsites", [0,1])
In [6]: cml.get_option("model")
Out[6]: 0
In [7]: cml.alignment = "alignment.phylip"
In [8]: cml.tree = "species.tree"
In [9]: cml.working_dir = "working_dir"
In [10]: cml.out_file = "results.out"
In [11]: cml.run()
In [12]: cml.results
Out[12]:
{'Models': {0: {'Description': 'one-ratio',
'Tree length': 1.16479,
'dN': 0.22559999999999999,
'dS': 0.82599999999999996,
'kappa': 2.26301,
'lnL': -3269.9379349999999,
'omega': 0.27313999999999999},
1: {'Description': 'NearlyNeutral (2 categories)',
'Site Classes': {0: {'omega': 0.071529999999999996,
'proportion': 0.71372999999999998},
1: {'omega': 1.0,
'proportion': 0.28627000000000002}},
'Tree length': 1.2122999999999999,
'kappa': 2.34694,
'lnL': -3248.504981}}}