File: evo-tr-codon-model.rst

package info (click to toggle)
python-cogent 2024.5.7a1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 74,600 kB
  • sloc: python: 92,479; makefile: 117; sh: 16
file content (38 lines) | stat: -rw-r--r-- 1,160 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
.. jupyter-execute::
    :hide-code:

    import set_working_directory

Applying a time-reversible codon model
--------------------------------------

We display the full set of codon models available.

.. jupyter-execute::

    from cogent3 import available_models

    available_models("codon")

Using the conditional nucleotide form codon model
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The CNFGTR model (`Yap et al <https://www.ncbi.nlm.nih.gov/pubmed/19815689>`__) is the most robust of the time-reversible codon models available (`Kaehler et al <https://www.ncbi.nlm.nih.gov/pubmed/28175284>`__). By default, this model does not optimise the codon frequencies but uses the average estimated from the alignment. We configure the model to optimise the root motif probabilities.

.. jupyter-execute::

    from cogent3 import get_app

    loader = get_app("load_aligned", format="fasta", moltype="dna")
    aln = loader("data/primate_brca1.fasta")
    model = get_app("model",
        "CNFGTR",
        tree="data/primate_brca1.tree",
        optimise_motif_probs=True,
    )
    result = model(aln)
    result

.. jupyter-execute::

    result.lf