natsel_timehet
– a test of branch heterogeneity#
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"
We employ codon models to test whether the mode of natural selection affecting human and chimpanzee lineages is distinctive. This is done by specifying the edges of interest (Yang 1998).
Warning
I’m setting optimise_motif_probs=False
to speed up execution of the examples, not because it’s a good idea!
from cogent3 import get_app
loader = get_app("load_aligned", format="fasta", moltype="dna")
aln = loader("data/primate_brca1.fasta")
hc_differ = get_app("natsel_timehet",
"GNC",
tree="data/primate_brca1.tree",
optimise_motif_probs=False,
tip1="Human",
tip2="Chimpanzee",
)
result = hc_differ(aln)
result
LR | df | pvalue |
---|---|---|
4.9248 | 1 | 0.0265 |
hypothesis | key | lnL | nfp | DLC | unique_Q |
---|---|---|---|---|---|
null | 'GNC-null' | -6713.2743 | 23 | True | True |
alt | 'GNC-alt' | -6710.8118 | 24 | True | True |
result.alt.lf
GNC-alt
log-likelihood = -6710.8118
number of free parameters = 24
A>C | A>G | A>T | C>A | C>G | C>T | G>A | G>C | G>T | T>A |
---|---|---|---|---|---|---|---|---|---|
0.8620 | 3.5361 | 0.9790 | 1.6698 | 2.2059 | 6.2630 | 7.9209 | 1.2265 | 0.8024 | 1.2882 |
T>C |
---|
3.0675 |
edge | parent | length | omega |
---|---|---|---|
Galago | root | 0.5237 | 0.7906 |
HowlerMon | root | 0.1339 | 0.7906 |
Rhesus | edge.3 | 0.0640 | 0.7906 |
Orangutan | edge.2 | 0.0233 | 0.7906 |
Gorilla | edge.1 | 0.0075 | 0.7906 |
Human | edge.0 | 0.0182 | 2.6351 |
Chimpanzee | edge.0 | 0.0085 | 2.6351 |
edge.0 | edge.1 | 0.0000 | 0.7906 |
edge.1 | edge.2 | 0.0100 | 0.7906 |
edge.2 | edge.3 | 0.0366 | 0.7906 |
edge.3 | root | 0.0238 | 0.7906 |
AAA | AAC | AAG | AAT | ACA | ACC | ACG | ACT | AGA | AGC |
---|---|---|---|---|---|---|---|---|---|
0.0556 | 0.0235 | 0.0344 | 0.0556 | 0.0228 | 0.0046 | 0.0008 | 0.0289 | 0.0231 | 0.0286 |
AGG | AGT | ATA | ATC | ATG | ATT | CAA | CAC | CAG | CAT |
---|---|---|---|---|---|---|---|---|---|
0.0140 | 0.0381 | 0.0186 | 0.0070 | 0.0128 | 0.0192 | 0.0196 | 0.0052 | 0.0238 | 0.0221 |
CCA | CCC | CCG | CCT | CGA | CGC | CGG | CGT | CTA | CTC |
---|---|---|---|---|---|---|---|---|---|
0.0195 | 0.0062 | 0.0006 | 0.0263 | 0.0011 | 0.0009 | 0.0023 | 0.0032 | 0.0137 | 0.0078 |
CTG | CTT | GAA | GAC | GAG | GAT | GCA | GCC | GCG | GCT |
---|---|---|---|---|---|---|---|---|---|
0.0125 | 0.0105 | 0.0755 | 0.0105 | 0.0303 | 0.0315 | 0.0158 | 0.0096 | 0.0014 | 0.0137 |
GGA | GGC | GGG | GGT | GTA | GTC | GTG | GTT | TAC | TAT |
---|---|---|---|---|---|---|---|---|---|
0.0161 | 0.0090 | 0.0067 | 0.0133 | 0.0148 | 0.0070 | 0.0069 | 0.0213 | 0.0023 | 0.0101 |
TCA | TCC | TCG | TCT | TGC | TGG | TGT | TTA | TTC | TTG |
---|---|---|---|---|---|---|---|---|---|
0.0221 | 0.0082 | 0.0015 | 0.0251 | 0.0018 | 0.0040 | 0.0201 | 0.0212 | 0.0078 | 0.0108 |
TTT |
---|
0.0187 |