Applying GNC, a non-stationary codon model#
Note
These docs now use the new_type
core objects via the following setting.
import os
# using new types without requiring an explicit argument
os.environ["COGENT3_NEW_TYPE"] = "1"
See Kaehler et al for the formal description of this model. Note that perform hypothesis testing using this model elsewhere.
We apply this to a sample alignment.
from cogent3 import get_app
loader = get_app("load_aligned", format="fasta", moltype="dna")
aln = loader("data/primate_brca1.fasta")
The model is specified using it’s abbreviation.
model = get_app("model", "GNC", tree="data/primate_brca1.tree")
result = model(aln)
result
key | lnL | nfp | DLC | unique_Q |
---|---|---|---|---|
'GNC' | -6713.2743 | 23 | True | True |
result.lf
GNC
log-likelihood = -6713.2743
number of free parameters = 23
A>C | A>G | A>T | C>A | C>G | C>T | G>A | G>C | G>T | T>A | T>C | omega |
---|---|---|---|---|---|---|---|---|---|---|---|
0.86 | 3.54 | 0.98 | 1.67 | 2.20 | 6.26 | 7.92 | 1.23 | 0.80 | 1.29 | 3.07 | 0.82 |
edge | parent | length |
---|---|---|
Galago | root | 0.52 |
HowlerMon | root | 0.13 |
Rhesus | edge.3 | 0.06 |
Orangutan | edge.2 | 0.02 |
Gorilla | edge.1 | 0.01 |
Human | edge.0 | 0.02 |
Chimpanzee | edge.0 | 0.01 |
edge.0 | edge.1 | 0.00 |
edge.1 | edge.2 | 0.01 |
edge.2 | edge.3 | 0.04 |
edge.3 | root | 0.02 |
AAA | AAC | AAG | AAT | ACA | ACC | ACG | ACT | AGA | AGC | AGG | AGT | ATA |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0.06 | 0.02 | 0.03 | 0.06 | 0.02 | 0.00 | 0.00 | 0.03 | 0.02 | 0.03 | 0.01 | 0.04 | 0.02 |
ATC | ATG | ATT | CAA | CAC | CAG | CAT | CCA | CCC | CCG | CCT | CGA | CGC |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0.01 | 0.01 | 0.02 | 0.02 | 0.01 | 0.02 | 0.02 | 0.02 | 0.01 | 0.00 | 0.03 | 0.00 | 0.00 |
CGG | CGT | CTA | CTC | CTG | CTT | GAA | GAC | GAG | GAT | GCA | GCC | GCG |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0.00 | 0.00 | 0.01 | 0.01 | 0.01 | 0.01 | 0.08 | 0.01 | 0.03 | 0.03 | 0.02 | 0.01 | 0.00 |
GCT | GGA | GGC | GGG | GGT | GTA | GTC | GTG | GTT | TAC | TAT | TCA | TCC |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0.01 | 0.02 | 0.01 | 0.01 | 0.01 | 0.01 | 0.01 | 0.01 | 0.02 | 0.00 | 0.01 | 0.02 | 0.01 |
TCG | TCT | TGC | TGG | TGT | TTA | TTC | TTG | TTT |
---|---|---|---|---|---|---|---|---|
0.00 | 0.03 | 0.00 | 0.00 | 0.02 | 0.02 | 0.01 | 0.01 | 0.02 |
We can obtain the tree with branch lengths as ENS#
If this tree is written to newick (using the write()
method), the lengths will now be ENS.
tree = result.tree
fig = tree.get_figure()
fig.scale_bar = "top right"
fig.show(width=500, height=500)