{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Applying a time-reversible codon model\n",
    "\n",
    "We display the full set of codon models available."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table>\n",
       "<style>\n",
       "tr:last-child {border-bottom: 1px solid #000;} tr > th {text-align: center !important;} tr > td {text-align: left !important;}\n",
       "</style>\n",
       "<caption style=\"color: rgb(250, 250, 250); background: rgba(30, 140, 200, 1); align=top;\"><span style=\"font-weight: bold;\">Specify a model using 'Abbreviation' (case sensitive).</span><span></span></caption>\n",
       "<thead style=\"background: rgba(161, 195, 209, 0.75); font-weight: bold; text-align: center;\">\n",
       "<th>Model Type</th>\n",
       "<th>Abbreviation</th>\n",
       "<th>Description</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td>codon</td>\n",
       "<td>CNFGTR</td>\n",
       "<td>Conditional nucleotide frequency codon substitution model, GTR variant (with params analagous to the nucleotide GTR model). Yap, Lindsay, Easteal and Huttley, 2010, Mol Biol Evol 27: 726-734</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>codon</td>\n",
       "<td>CNFHKY</td>\n",
       "<td>Conditional nucleotide frequency codon substitution model, HKY variant (with kappa, the ratio of transitions to transversions) Yap, Lindsay, Easteal and Huttley, 2010, Mol Biol Evol 27: 726-734</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>codon</td>\n",
       "<td>MG94HKY</td>\n",
       "<td>Muse and Gaut 1994 codon substitution model, HKY variant (with kappa, the ratio of transitions to transversions) Muse and Gaut, 1994, Mol Biol Evol, 11, 715-24</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>codon</td>\n",
       "<td>MG94GTR</td>\n",
       "<td>Muse and Gaut 1994 codon substitution model, GTR variant (with params analagous to the nucleotide GTR model) Muse and Gaut, 1994, Mol Biol Evol, 11, 715-24</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>codon</td>\n",
       "<td>GY94</td>\n",
       "<td>Goldman and Yang 1994 codon substitution model. N Goldman and Z Yang, 1994, Mol Biol Evol, 11(5):725-36.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>codon</td>\n",
       "<td>Y98</td>\n",
       "<td>Yang's 1998 substitution model, a derivative of the GY94. Z Yang, 1998, Mol Biol Evol, 15(5):568-73</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>codon</td>\n",
       "<td>H04G</td>\n",
       "<td>Huttley 2004 CpG substitution model. Includes a term for substitutions to or from CpG's. GA Huttley, 2004, Mol Biol Evol, 21(9):1760-8</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>codon</td>\n",
       "<td>H04GK</td>\n",
       "<td>Huttley 2004 CpG substitution model. Includes a term for transition substitutions to or from CpG's. GA Huttley, 2004, Mol Biol Evol, 21(9):1760-8</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>codon</td>\n",
       "<td>H04GGK</td>\n",
       "<td>Huttley 2004 CpG substitution model. Includes a general term for substitutions to or from CpG's and an adjustment for CpG transitions. GA Huttley, 2004, Mol Biol Evol, 21(9):1760-8</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>codon</td>\n",
       "<td>GNC</td>\n",
       "<td>General Nucleotide Codon, a non-reversible codon model. Kaehler, Yap, Huttley, 2017, Gen Biol Evol 9(1): 134–49</td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n",
       "<p>\n",
       "10 rows x 3 columns</p>"
      ],
      "text/plain": [
       "Specify a model using 'Abbreviation' (case sensitive).\n",
       "===============================================================================================================================================================================================================================\n",
       "Model Type    Abbreviation                                                                                                                                                                                          Description\n",
       "-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n",
       "     codon          CNFGTR       Conditional nucleotide frequency codon substitution model, GTR variant (with params analagous to the nucleotide GTR model). Yap, Lindsay, Easteal and Huttley, 2010, Mol Biol Evol 27: 726-734\n",
       "     codon          CNFHKY    Conditional nucleotide frequency codon substitution model, HKY variant (with kappa, the ratio of transitions to transversions) Yap, Lindsay, Easteal and Huttley, 2010, Mol Biol Evol 27: 726-734\n",
       "     codon         MG94HKY                                      Muse and Gaut 1994 codon substitution model, HKY variant (with kappa, the ratio of transitions to transversions) Muse and Gaut, 1994, Mol Biol Evol, 11, 715-24\n",
       "     codon         MG94GTR                                          Muse and Gaut 1994 codon substitution model, GTR variant (with params analagous to the nucleotide GTR model) Muse and Gaut, 1994, Mol Biol Evol, 11, 715-24\n",
       "     codon            GY94                                                                                             Goldman and Yang 1994 codon substitution model. N Goldman and Z Yang, 1994, Mol Biol Evol, 11(5):725-36.\n",
       "     codon             Y98                                                                                                  Yang's 1998 substitution model, a derivative of the GY94. Z Yang, 1998, Mol Biol Evol, 15(5):568-73\n",
       "     codon            H04G                                                               Huttley 2004 CpG substitution model. Includes a term for substitutions to or from CpG's. GA Huttley, 2004, Mol Biol Evol, 21(9):1760-8\n",
       "     codon           H04GK                                                    Huttley 2004 CpG substitution model. Includes a term for transition substitutions to or from CpG's. GA Huttley, 2004, Mol Biol Evol, 21(9):1760-8\n",
       "     codon          H04GGK                 Huttley 2004 CpG substitution model. Includes a general term for substitutions to or from CpG's and an adjustment for CpG transitions. GA Huttley, 2004, Mol Biol Evol, 21(9):1760-8\n",
       "     codon             GNC                                                                                      General Nucleotide Codon, a non-reversible codon model. Kaehler, Yap, Huttley, 2017, Gen Biol Evol 9(1): 134–49\n",
       "-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n",
       "\n",
       "10 rows x 3 columns"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from cogent3 import available_models\n",
    "\n",
    "available_models(\"codon\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Using the conditional nucleotide form codon model\n",
    "\n",
    "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."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table>\n",
       "<style>\n",
       "tr:last-child {border-bottom: 1px solid #000;} tr > th {text-align: center !important;} tr > td {text-align: left !important;}\n",
       "</style>\n",
       "<caption style=\"color: rgb(250, 250, 250); background: rgba(30, 140, 200, 1); align=top;\"><span style=\"font-weight: bold;\">CNFGTR</span><span></span></caption>\n",
       "<thead style=\"background: rgba(161, 195, 209, 0.75); font-weight: bold; text-align: center;\">\n",
       "<th>key</th>\n",
       "<th>lnL</th>\n",
       "<th>nfp</th>\n",
       "<th>DLC</th>\n",
       "<th>unique_Q</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td></td>\n",
       "<td style=\"font-family: monospace !important;\">-6739.3067</td>\n",
       "<td style=\"font-family: monospace !important;\">77</td>\n",
       "<td>True</td>\n",
       "<td></td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "CNFGTR\n",
       "============================================\n",
       "key           lnL    nfp     DLC    unique_Q\n",
       "--------------------------------------------\n",
       "       -6739.3067     77    True            \n",
       "--------------------------------------------\n",
       "\n",
       "1 rows x 5 columns"
      ]
     },
     "execution_count": 2,
     "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",
    "model = evo.model(\"CNFGTR\", \n",
    "                  tree=\"../data/primate_brca1.tree\", \n",
    "                  sm_args=dict(optimise_motif_probs=True))\n",
    "result = model(aln)\n",
    "result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<h4>CNFGTR</h4>\n",
       "<p>log-likelihood = -6739.3067</p>\n",
       "<p>number of free parameters = 77</p>\n",
       "<table>\n",
       "<style>\n",
       "tr:last-child {border-bottom: 1px solid #000;} tr > th {text-align: center !important;} tr > td {text-align: left !important;}\n",
       "</style>\n",
       "<caption style=\"color: rgb(250, 250, 250); background: rgba(30, 140, 200, 1); align=top;\"><span style=\"font-weight: bold;\">Global params</span><span></span></caption>\n",
       "<thead style=\"background: rgba(161, 195, 209, 0.75); font-weight: bold; text-align: center;\">\n",
       "<th>A/C</th>\n",
       "<th>A/G</th>\n",
       "<th>A/T</th>\n",
       "<th>C/G</th>\n",
       "<th>C/T</th>\n",
       "<th>omega</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td style=\"font-family: monospace !important;\">1.0656</td>\n",
       "<td style=\"font-family: monospace !important;\">3.9391</td>\n",
       "<td style=\"font-family: monospace !important;\">0.7851</td>\n",
       "<td style=\"font-family: monospace !important;\">1.9475</td>\n",
       "<td style=\"font-family: monospace !important;\">4.2265</td>\n",
       "<td style=\"font-family: monospace !important;\">0.7569</td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n",
       "\n",
       "<table>\n",
       "<style>\n",
       "tr:last-child {border-bottom: 1px solid #000;} tr > th {text-align: center !important;} tr > td {text-align: left !important;}\n",
       "</style>\n",
       "<caption style=\"color: rgb(250, 250, 250); background: rgba(30, 140, 200, 1); align=top;\"><span style=\"font-weight: bold;\">Edge params</span><span></span></caption>\n",
       "<thead style=\"background: rgba(161, 195, 209, 0.75); font-weight: bold; text-align: center;\">\n",
       "<th>edge</th>\n",
       "<th>parent</th>\n",
       "<th>length</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Galago</td>\n",
       "<td>root</td>\n",
       "<td style=\"font-family: monospace !important;\">0.5330</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">HowlerMon</td>\n",
       "<td>root</td>\n",
       "<td style=\"font-family: monospace !important;\">0.1365</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Rhesus</td>\n",
       "<td>edge.3</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0659</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Orangutan</td>\n",
       "<td>edge.2</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0233</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Gorilla</td>\n",
       "<td>edge.1</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0075</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Human</td>\n",
       "<td>edge.0</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0182</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Chimpanzee</td>\n",
       "<td>edge.0</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0085</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">edge.0</td>\n",
       "<td>edge.1</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">edge.1</td>\n",
       "<td>edge.2</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0101</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">edge.2</td>\n",
       "<td>edge.3</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0352</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">edge.3</td>\n",
       "<td>root</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0228</td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n",
       "\n",
       "<table>\n",
       "<style>\n",
       "tr:last-child {border-bottom: 1px solid #000;} tr > th {text-align: center !important;} tr > td {text-align: left !important;}\n",
       "</style>\n",
       "<caption style=\"color: rgb(250, 250, 250); background: rgba(30, 140, 200, 1); align=top;\"><span style=\"font-weight: bold;\">Motif params</span><span></span></caption>\n",
       "<thead style=\"background: rgba(161, 195, 209, 0.75); font-weight: bold; text-align: center;\">\n",
       "<th>AAA</th>\n",
       "<th>AAC</th>\n",
       "<th>AAG</th>\n",
       "<th>AAT</th>\n",
       "<th>ACA</th>\n",
       "<th>ACC</th>\n",
       "<th>ACG</th>\n",
       "<th>ACT</th>\n",
       "<th>AGA</th>\n",
       "<th>AGC</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td style=\"font-family: monospace !important;\">0.0540</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0242</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0307</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0543</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0237</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0063</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0021</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0297</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0238</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0280</td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n",
       "<table>\n",
       "<thead style=\"background: rgba(161, 195, 209, 0.75); font-weight: bold; text-align: center;\">\n",
       "<th>AGG</th>\n",
       "<th>AGT</th>\n",
       "<th>ATA</th>\n",
       "<th>ATC</th>\n",
       "<th>ATG</th>\n",
       "<th>ATT</th>\n",
       "<th>CAA</th>\n",
       "<th>CAC</th>\n",
       "<th>CAG</th>\n",
       "<th>CAT</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td style=\"font-family: monospace !important;\">0.0122</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0405</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0226</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0071</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0141</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0203</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0228</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0063</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0220</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0237</td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n",
       "<table>\n",
       "<thead style=\"background: rgba(161, 195, 209, 0.75); font-weight: bold; text-align: center;\">\n",
       "<th>CCA</th>\n",
       "<th>CCC</th>\n",
       "<th>CCG</th>\n",
       "<th>CCT</th>\n",
       "<th>CGA</th>\n",
       "<th>CGC</th>\n",
       "<th>CGG</th>\n",
       "<th>CGT</th>\n",
       "<th>CTA</th>\n",
       "<th>CTC</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td style=\"font-family: monospace !important;\">0.0165</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0043</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0021</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0239</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0022</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0012</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0035</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0058</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0123</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0065</td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n",
       "<table>\n",
       "<thead style=\"background: rgba(161, 195, 209, 0.75); font-weight: bold; text-align: center;\">\n",
       "<th>CTG</th>\n",
       "<th>CTT</th>\n",
       "<th>GAA</th>\n",
       "<th>GAC</th>\n",
       "<th>GAG</th>\n",
       "<th>GAT</th>\n",
       "<th>GCA</th>\n",
       "<th>GCC</th>\n",
       "<th>GCG</th>\n",
       "<th>GCT</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td style=\"font-family: monospace !important;\">0.0098</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0105</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0703</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0112</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0263</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0310</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0154</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0083</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0036</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0145</td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n",
       "<table>\n",
       "<thead style=\"background: rgba(161, 195, 209, 0.75); font-weight: bold; text-align: center;\">\n",
       "<th>GGA</th>\n",
       "<th>GGC</th>\n",
       "<th>GGG</th>\n",
       "<th>GGT</th>\n",
       "<th>GTA</th>\n",
       "<th>GTC</th>\n",
       "<th>GTG</th>\n",
       "<th>GTT</th>\n",
       "<th>TAC</th>\n",
       "<th>TAT</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td style=\"font-family: monospace !important;\">0.0151</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0072</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0051</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0139</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0170</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0077</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0094</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0210</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0036</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0171</td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n",
       "<table>\n",
       "<thead style=\"background: rgba(161, 195, 209, 0.75); font-weight: bold; text-align: center;\">\n",
       "<th>TCA</th>\n",
       "<th>TCC</th>\n",
       "<th>TCG</th>\n",
       "<th>TCT</th>\n",
       "<th>TGC</th>\n",
       "<th>TGG</th>\n",
       "<th>TGT</th>\n",
       "<th>TTA</th>\n",
       "<th>TTC</th>\n",
       "<th>TTG</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td style=\"font-family: monospace !important;\">0.0220</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0083</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0039</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0214</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0038</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0033</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0201</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0222</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0051</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0107</td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n",
       "<table>\n",
       "<thead style=\"background: rgba(161, 195, 209, 0.75); font-weight: bold; text-align: center;\">\n",
       "<th>TTT</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td style=\"font-family: monospace !important;\">0.0146</td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "CNFGTR\n",
       "log-likelihood = -6739.3067\n",
       "number of free parameters = 77\n",
       "========================================================\n",
       "   A/C       A/G       A/T       C/G       C/T     omega\n",
       "--------------------------------------------------------\n",
       "1.0656    3.9391    0.7851    1.9475    4.2265    0.7569\n",
       "--------------------------------------------------------\n",
       "==============================\n",
       "      edge    parent    length\n",
       "------------------------------\n",
       "    Galago      root    0.5330\n",
       " HowlerMon      root    0.1365\n",
       "    Rhesus    edge.3    0.0659\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.0101\n",
       "    edge.2    edge.3    0.0352\n",
       "    edge.3      root    0.0228\n",
       "------------------------------\n",
       "============================================================================\n",
       "   AAA       AAC       AAG       AAT       ACA       ACC       ACG       ACT\n",
       "----------------------------------------------------------------------------\n",
       "0.0540    0.0242    0.0307    0.0543    0.0237    0.0063    0.0021    0.0297\n",
       "----------------------------------------------------------------------------\n",
       "\n",
       "continued: \n",
       "============================================================================\n",
       "   AGA       AGC       AGG       AGT       ATA       ATC       ATG       ATT\n",
       "----------------------------------------------------------------------------\n",
       "0.0238    0.0280    0.0122    0.0405    0.0226    0.0071    0.0141    0.0203\n",
       "----------------------------------------------------------------------------\n",
       "\n",
       "continued: \n",
       "============================================================================\n",
       "   CAA       CAC       CAG       CAT       CCA       CCC       CCG       CCT\n",
       "----------------------------------------------------------------------------\n",
       "0.0228    0.0063    0.0220    0.0237    0.0165    0.0043    0.0021    0.0239\n",
       "----------------------------------------------------------------------------\n",
       "\n",
       "continued: \n",
       "============================================================================\n",
       "   CGA       CGC       CGG       CGT       CTA       CTC       CTG       CTT\n",
       "----------------------------------------------------------------------------\n",
       "0.0022    0.0012    0.0035    0.0058    0.0123    0.0065    0.0098    0.0105\n",
       "----------------------------------------------------------------------------\n",
       "\n",
       "continued: \n",
       "============================================================================\n",
       "   GAA       GAC       GAG       GAT       GCA       GCC       GCG       GCT\n",
       "----------------------------------------------------------------------------\n",
       "0.0703    0.0112    0.0263    0.0310    0.0154    0.0083    0.0036    0.0145\n",
       "----------------------------------------------------------------------------\n",
       "\n",
       "continued: \n",
       "============================================================================\n",
       "   GGA       GGC       GGG       GGT       GTA       GTC       GTG       GTT\n",
       "----------------------------------------------------------------------------\n",
       "0.0151    0.0072    0.0051    0.0139    0.0170    0.0077    0.0094    0.0210\n",
       "----------------------------------------------------------------------------\n",
       "\n",
       "continued: \n",
       "============================================================================\n",
       "   TAC       TAT       TCA       TCC       TCG       TCT       TGC       TGG\n",
       "----------------------------------------------------------------------------\n",
       "0.0036    0.0171    0.0220    0.0083    0.0039    0.0214    0.0038    0.0033\n",
       "----------------------------------------------------------------------------\n",
       "\n",
       "continued: \n",
       "==============================================\n",
       "   TGT       TTA       TTC       TTG       TTT\n",
       "----------------------------------------------\n",
       "0.0201    0.0222    0.0051    0.0107    0.0146\n",
       "----------------------------------------------"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result.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
}
