{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# `natsel_neutral` -- a test for selective neutrality\n", "\n", "We employ codon models to test hypotheses regarding the mode of natural selection that has operated on a gene.\n", "\n", "Noting that ω (omega) is the ratio of nonsynonymous substitutions to synonymous substitutions, ω=1 is indicative a gene is evolving neutrally. (Note I'm setting `optimise_motif_probs=False` to speed up execution of the examples, not because it's a good idea!)" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "cogent3.app.result.hypothesis_result" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from cogent3.app import io, evo\n", "\n", "loader = io.load_aligned(format=\"fasta\", moltype=\"dna\")\n", "aln = loader(\"../data/primate_brca1.fasta\")\n", "\n", "omega_eq_1 = evo.natsel_neutral(\"GNC\",\n", " tree=\"../data/primate_brca1.tree\",\n", " optimise_motif_probs=False)\n", "result = omega_eq_1(aln)\n", "type(result)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
Statistics
LRdfpvalue
4.503410.0338
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
hypothesiskeylnLnfpDLCunique_Q
null'GNC-null'-6715.525022True
alt'GNC-alt'-6713.273323True
\n" ], "text/plain": [ "Statistics\n", "======================\n", " LR df pvalue\n", "----------------------\n", "4.5034 1 0.0338\n", "----------------------\n", "=================================================================\n", "hypothesis key lnL nfp DLC unique_Q\n", "-----------------------------------------------------------------\n", " null 'GNC-null' -6715.5250 22 True \n", " alt 'GNC-alt' -6713.2733 23 True \n", "-----------------------------------------------------------------" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "

GNC-alt

\n", "

log-likelihood = -6713.2733

\n", "

number of free parameters = 23

\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
Global params
A>CA>GA>TC>AC>GC>TG>AG>CG>TT>A
0.86143.53730.97921.66672.20426.25657.91951.22530.80141.2911
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
T>Comega
3.07230.8204
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
Edge params
edgeparentlength
Galagoroot0.5232
HowlerMonroot0.1338
Rhesusedge.30.0640
Orangutanedge.20.0233
Gorillaedge.10.0075
Humanedge.00.0182
Chimpanzeeedge.00.0085
edge.0edge.10.0000
edge.1edge.20.0100
edge.2edge.30.0366
edge.3root0.0238
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
Motif params
AAAAACAAGAATACAACCACGACTAGAAGC
0.05560.02350.03440.05560.02280.00460.00080.02890.02310.0286
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
AGGAGTATAATCATGATTCAACACCAGCAT
0.01400.03810.01860.00700.01280.01920.01960.00520.02380.0221
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
CCACCCCCGCCTCGACGCCGGCGTCTACTC
0.01950.00620.00060.02630.00110.00090.00230.00320.01370.0078
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
CTGCTTGAAGACGAGGATGCAGCCGCGGCT
0.01250.01050.07550.01050.03030.03150.01580.00960.00140.0137
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
GGAGGCGGGGGTGTAGTCGTGGTTTACTAT
0.01610.00900.00670.01330.01480.00700.00690.02130.00230.0101
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
TCATCCTCGTCTTGCTGGTGTTTATTCTTG
0.02210.00820.00150.02510.00180.00400.02010.02120.00780.0108
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
TTT
0.0187
\n" ], "text/plain": [ "GNC-alt\n", "log-likelihood = -6713.2733\n", "number of free parameters = 23\n", "============================================================================\n", " A>C A>G A>T C>A C>G C>T G>A G>C\n", "----------------------------------------------------------------------------\n", "0.8614 3.5373 0.9792 1.6667 2.2042 6.2565 7.9195 1.2253\n", "----------------------------------------------------------------------------\n", "\n", "continued: \n", "====================================\n", " G>T T>A T>C omega\n", "------------------------------------\n", "0.8014 1.2911 3.0723 0.8204\n", "------------------------------------\n", "\n", "==============================\n", " edge parent length\n", "------------------------------\n", " Galago root 0.5232\n", " HowlerMon root 0.1338\n", " Rhesus edge.3 0.0640\n", " Orangutan edge.2 0.0233\n", " Gorilla edge.1 0.0075\n", " Human edge.0 0.0182\n", "Chimpanzee edge.0 0.0085\n", " edge.0 edge.1 0.0000\n", " edge.1 edge.2 0.0100\n", " edge.2 edge.3 0.0366\n", " edge.3 root 0.0238\n", "------------------------------\n", "============================================================================\n", " AAA AAC AAG AAT ACA ACC ACG ACT\n", "----------------------------------------------------------------------------\n", "0.0556 0.0235 0.0344 0.0556 0.0228 0.0046 0.0008 0.0289\n", "----------------------------------------------------------------------------\n", "\n", "continued: \n", "============================================================================\n", " AGA AGC AGG AGT ATA ATC ATG ATT\n", "----------------------------------------------------------------------------\n", "0.0231 0.0286 0.0140 0.0381 0.0186 0.0070 0.0128 0.0192\n", "----------------------------------------------------------------------------\n", "\n", "continued: \n", "============================================================================\n", " CAA CAC CAG CAT CCA CCC CCG CCT\n", "----------------------------------------------------------------------------\n", "0.0196 0.0052 0.0238 0.0221 0.0195 0.0062 0.0006 0.0263\n", "----------------------------------------------------------------------------\n", "\n", "continued: \n", "============================================================================\n", " CGA CGC CGG CGT CTA CTC CTG CTT\n", "----------------------------------------------------------------------------\n", "0.0011 0.0009 0.0023 0.0032 0.0137 0.0078 0.0125 0.0105\n", "----------------------------------------------------------------------------\n", "\n", "continued: \n", "============================================================================\n", " GAA GAC GAG GAT GCA GCC GCG GCT\n", "----------------------------------------------------------------------------\n", "0.0755 0.0105 0.0303 0.0315 0.0158 0.0096 0.0014 0.0137\n", "----------------------------------------------------------------------------\n", "\n", "continued: \n", "============================================================================\n", " GGA GGC GGG GGT GTA GTC GTG GTT\n", "----------------------------------------------------------------------------\n", "0.0161 0.0090 0.0067 0.0133 0.0148 0.0070 0.0069 0.0213\n", "----------------------------------------------------------------------------\n", "\n", "continued: \n", "============================================================================\n", " TAC TAT TCA TCC TCG TCT TGC TGG\n", "----------------------------------------------------------------------------\n", "0.0023 0.0101 0.0221 0.0082 0.0015 0.0251 0.0018 0.0040\n", "----------------------------------------------------------------------------\n", "\n", "continued: \n", "==============================================\n", " TGT TTA TTC TTG TTT\n", "----------------------------------------------\n", "0.0201 0.0212 0.0078 0.0108 0.0187\n", "----------------------------------------------" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result.alt.lf" ] } ], "metadata": { "kernelspec": { "display_name": "Python [conda env:c3dev] *", "language": "python", "name": "conda-env-c3dev-py" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.1" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": {}, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 4 }