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
Statistics
LRdfpvalue
4.924810.0265
hypothesiskeylnLnfpDLCunique_Q
null'GNC-null'-6713.274323TrueTrue
alt'GNC-alt'-6710.811824TrueTrue
result.alt.lf

GNC-alt

log-likelihood = -6710.8118

number of free parameters = 24

Global params
A>CA>GA>TC>AC>GC>TG>AG>CG>TT>AT>C
0.863.540.981.672.216.267.921.230.801.293.07
Edge params
edgeparentlengthomega
Galagoroot0.520.79
HowlerMonroot0.130.79
Rhesusedge.30.060.79
Orangutanedge.20.020.79
Gorillaedge.10.010.79
Humanedge.00.022.64
Chimpanzeeedge.00.012.64
edge.0edge.10.000.79
edge.1edge.20.010.79
edge.2edge.30.040.79
edge.3root0.020.79
Motif params
AAAAACAAGAATACAACCACGACTAGAAGCAGGAGTATA
0.060.020.030.060.020.000.000.030.020.030.010.040.02
continuation
ATCATGATTCAACACCAGCATCCACCCCCGCCTCGACGC
0.010.010.020.020.010.020.020.020.010.000.030.000.00
continuation
CGGCGTCTACTCCTGCTTGAAGACGAGGATGCAGCCGCG
0.000.000.010.010.010.010.080.010.030.030.020.010.00
continuation
GCTGGAGGCGGGGGTGTAGTCGTGGTTTACTATTCATCC
0.010.020.010.010.010.010.010.010.020.000.010.020.01
continuation
TCGTCTTGCTGGTGTTTATTCTTGTTT
0.000.030.000.000.020.020.010.010.02