{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# `natsel_zhang` -- a branch-site test\n",
    "\n",
    "This is the hypothesis test presented in [Xhang et al](https://www.ncbi.nlm.nih.gov/pubmed/16107592). This test evaluates the hypothesis that a set of sites have undergone positive natural selection on a pre-specified set of lineages.\n",
    "\n",
    "For this model class, there are groups of branches for which all positions are evolving neutrally but some proportion of those neutrally evolving sites change to adaptively evolving on so-called foreground edges. For the current example, we'll define the Chimpanzee and Human branches as foreground and everything else as background. The following table defines the parameter scopes.\n",
    "\n",
    "| Site Class |    Proportion |          Background Edges |          Foreground Edges |\n",
    "|------------|---------------|---------------------------|---------------------------|\n",
    "|          0 | p<sub>0</sub> | 0 < omega<sub>0</sub> < 1 | 0 < omega<sub>0</sub> < 1 |\n",
    "|          1 | p<sub>1</sub> |     omega<sub>1</sub> = 1 |     omega<sub>1</sub> = 1 |\n",
    "|         2a | p<sub>2</sub> | 0 < omega<sub>0</sub> < 1 | 0 < omega<sub>2</sub> > 1 |\n",
    "|         2b | p<sub>3</sub> |     omega<sub>1</sub> = 1 | 0 < omega<sub>0</sub> < 1 |\n",
    "\n",
    "**NOTE:** Our implementation is not as parametrically succinct as that of Zhang et al, we have 1 additional bin probability."
   ]
  },
  {
   "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;\">Statistics</span><span></span></caption>\n",
       "<thead style=\"background: rgba(161, 195, 209, 0.75); font-weight: bold; text-align: center;\">\n",
       "<th>LR</th>\n",
       "<th>df</th>\n",
       "<th>pvalue</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td style=\"font-family: monospace !important;\">4.9647</td>\n",
       "<td style=\"font-family: monospace !important;\">3</td>\n",
       "<td style=\"font-family: monospace !important;\">0.1744</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",
       "<thead style=\"background: rgba(161, 195, 209, 0.75); font-weight: bold; text-align: center;\">\n",
       "<th>hypothesis</th>\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>null</td>\n",
       "<td>'GNC-null'</td>\n",
       "<td style=\"font-family: monospace !important;\">-6708.3119</td>\n",
       "<td style=\"font-family: monospace !important;\">24</td>\n",
       "<td>True</td>\n",
       "<td></td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>alt</td>\n",
       "<td>'GNC-alt'</td>\n",
       "<td style=\"font-family: monospace !important;\">-6705.8296</td>\n",
       "<td style=\"font-family: monospace !important;\">27</td>\n",
       "<td>True</td>\n",
       "<td></td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "Statistics\n",
       "======================\n",
       "    LR    df    pvalue\n",
       "----------------------\n",
       "4.9647     3    0.1744\n",
       "----------------------\n",
       "=================================================================\n",
       "hypothesis           key           lnL    nfp     DLC    unique_Q\n",
       "-----------------------------------------------------------------\n",
       "      null    'GNC-null'    -6708.3119     24    True            \n",
       "       alt     'GNC-alt'    -6705.8296     27    True            \n",
       "-----------------------------------------------------------------"
      ]
     },
     "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",
    "zhang_test = evo.natsel_zhang(\"GNC\",\n",
    "                              tree=\"../data/primate_brca1.tree\",\n",
    "                              optimise_motif_probs=False,\n",
    "                              tip1=\"Human\",\n",
    "                              tip2=\"Chimpanzee\")\n",
    "\n",
    "result = zhang_test(aln)\n",
    "result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<h4>GNC-alt</h4>\n",
       "<p>log-likelihood = -6705.8296</p>\n",
       "<p>number of free parameters = 27</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&gt;C</th>\n",
       "<th>A&gt;G</th>\n",
       "<th>A&gt;T</th>\n",
       "<th>C&gt;A</th>\n",
       "<th>C&gt;G</th>\n",
       "<th>C&gt;T</th>\n",
       "<th>G&gt;A</th>\n",
       "<th>G&gt;C</th>\n",
       "<th>G&gt;T</th>\n",
       "<th>T&gt;A</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td style=\"font-family: monospace !important;\">0.8555</td>\n",
       "<td style=\"font-family: monospace !important;\">3.5345</td>\n",
       "<td style=\"font-family: monospace !important;\">0.9745</td>\n",
       "<td style=\"font-family: monospace !important;\">1.6587</td>\n",
       "<td style=\"font-family: monospace !important;\">2.1938</td>\n",
       "<td style=\"font-family: monospace !important;\">6.2590</td>\n",
       "<td style=\"font-family: monospace !important;\">8.0110</td>\n",
       "<td style=\"font-family: monospace !important;\">1.2419</td>\n",
       "<td style=\"font-family: monospace !important;\">0.7942</td>\n",
       "<td style=\"font-family: monospace !important;\">1.2668</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>T&gt;C</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td style=\"font-family: monospace !important;\">2.9647</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;\">Bin params</span><span></span></caption>\n",
       "<thead style=\"background: rgba(161, 195, 209, 0.75); font-weight: bold; text-align: center;\">\n",
       "<th>bin</th>\n",
       "<th>bprobs</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">0</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0530</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">1</td>\n",
       "<td style=\"font-family: monospace !important;\">0.2661</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">2a</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0405</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">2b</td>\n",
       "<td style=\"font-family: monospace !important;\">0.6404</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.5420</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.1359</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.0648</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.0235</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.0099</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.0365</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.0234</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 bin 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>bin</th>\n",
       "<th>omega</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Galago</td>\n",
       "<td style=\"font-family: monospace !important;\">0</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;\">Galago</td>\n",
       "<td style=\"font-family: monospace !important;\">1</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Galago</td>\n",
       "<td>2a</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;\">Galago</td>\n",
       "<td>2b</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">HowlerMon</td>\n",
       "<td style=\"font-family: monospace !important;\">0</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;\">HowlerMon</td>\n",
       "<td style=\"font-family: monospace !important;\">1</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">HowlerMon</td>\n",
       "<td>2a</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;\">HowlerMon</td>\n",
       "<td>2b</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Rhesus</td>\n",
       "<td style=\"font-family: monospace !important;\">0</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;\">Rhesus</td>\n",
       "<td style=\"font-family: monospace !important;\">1</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Rhesus</td>\n",
       "<td>2a</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;\">Rhesus</td>\n",
       "<td>2b</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Orangutan</td>\n",
       "<td style=\"font-family: monospace !important;\">0</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;\">Orangutan</td>\n",
       "<td style=\"font-family: monospace !important;\">1</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Orangutan</td>\n",
       "<td>2a</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;\">Orangutan</td>\n",
       "<td>2b</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Gorilla</td>\n",
       "<td style=\"font-family: monospace !important;\">0</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;\">Gorilla</td>\n",
       "<td style=\"font-family: monospace !important;\">1</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Gorilla</td>\n",
       "<td>2a</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;\">Gorilla</td>\n",
       "<td>2b</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Human</td>\n",
       "<td style=\"font-family: monospace !important;\">0</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;\">Human</td>\n",
       "<td style=\"font-family: monospace !important;\">1</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Human</td>\n",
       "<td>2a</td>\n",
       "<td style=\"font-family: monospace !important;\">20.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Human</td>\n",
       "<td>2b</td>\n",
       "<td style=\"font-family: monospace !important;\">20.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Chimpanzee</td>\n",
       "<td style=\"font-family: monospace !important;\">0</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;\">Chimpanzee</td>\n",
       "<td style=\"font-family: monospace !important;\">1</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Chimpanzee</td>\n",
       "<td>2a</td>\n",
       "<td style=\"font-family: monospace !important;\">20.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Chimpanzee</td>\n",
       "<td>2b</td>\n",
       "<td style=\"font-family: monospace !important;\">20.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">edge.0</td>\n",
       "<td style=\"font-family: monospace !important;\">0</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.0</td>\n",
       "<td style=\"font-family: monospace !important;\">1</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">edge.0</td>\n",
       "<td>2a</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.0</td>\n",
       "<td>2b</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">edge.1</td>\n",
       "<td style=\"font-family: monospace !important;\">0</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 style=\"font-family: monospace !important;\">1</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">edge.1</td>\n",
       "<td>2a</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>2b</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">edge.2</td>\n",
       "<td style=\"font-family: monospace !important;\">0</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.2</td>\n",
       "<td style=\"font-family: monospace !important;\">1</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">edge.2</td>\n",
       "<td>2a</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.2</td>\n",
       "<td>2b</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">edge.3</td>\n",
       "<td style=\"font-family: monospace !important;\">0</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.3</td>\n",
       "<td style=\"font-family: monospace !important;\">1</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">edge.3</td>\n",
       "<td>2a</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.3</td>\n",
       "<td>2b</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</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.0556</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0235</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0344</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0556</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0228</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0046</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0008</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0289</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0231</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0286</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.0140</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0381</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0186</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0070</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0128</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0192</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0196</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0052</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0238</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0221</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.0195</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0062</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0006</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0263</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0011</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0009</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0023</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0032</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0137</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0078</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.0125</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0105</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0755</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0105</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0303</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0315</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0158</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0096</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0014</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0137</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.0161</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0090</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0067</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0133</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0148</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0070</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0069</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0213</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0023</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0101</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.0221</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0082</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0015</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0251</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0018</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0040</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0201</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0212</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0078</td>\n",
       "<td style=\"font-family: monospace !important;\">0.0108</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.0187</td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<cogent3.evolve.parameter_controller.AlignmentLikelihoodFunction at 0x11571e668>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result.alt.lf"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Getting the posterior probabilities of site-class membership"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "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",
       "<thead style=\"background: rgba(161, 195, 209, 0.75); font-weight: bold; text-align: center;\">\n",
       "<th></th>\n",
       "<th>0</th>\n",
       "<th>1</th>\n",
       "<th>2</th>\n",
       "<th>3</th>\n",
       "<th>4</th>\n",
       "<th>5</th>\n",
       "<th>6</th>\n",
       "<th>7</th>\n",
       "<th>8</th>\n",
       "<th>9</th>\n",
       "<th>10</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">0</td>\n",
       "<td style=\"font-family: monospace !important;\">0.076</td>\n",
       "<td style=\"font-family: monospace !important;\">0.043</td>\n",
       "<td style=\"font-family: monospace !important;\">0.000</td>\n",
       "<td style=\"font-family: monospace !important;\">0.067</td>\n",
       "<td style=\"font-family: monospace !important;\">0.058</td>\n",
       "<td style=\"font-family: monospace !important;\">0.080</td>\n",
       "<td style=\"font-family: monospace !important;\">0.043</td>\n",
       "<td style=\"font-family: monospace !important;\">0.061</td>\n",
       "<td style=\"font-family: monospace !important;\">0.052</td>\n",
       "<td style=\"font-family: monospace !important;\">0.041</td>\n",
       "<td style=\"font-family: monospace !important;\">0.039</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">1</td>\n",
       "<td style=\"font-family: monospace !important;\">0.255</td>\n",
       "<td style=\"font-family: monospace !important;\">0.271</td>\n",
       "<td style=\"font-family: monospace !important;\">0.294</td>\n",
       "<td style=\"font-family: monospace !important;\">0.259</td>\n",
       "<td style=\"font-family: monospace !important;\">0.263</td>\n",
       "<td style=\"font-family: monospace !important;\">0.253</td>\n",
       "<td style=\"font-family: monospace !important;\">0.271</td>\n",
       "<td style=\"font-family: monospace !important;\">0.262</td>\n",
       "<td style=\"font-family: monospace !important;\">0.266</td>\n",
       "<td style=\"font-family: monospace !important;\">0.271</td>\n",
       "<td style=\"font-family: monospace !important;\">0.272</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">2a</td>\n",
       "<td style=\"font-family: monospace !important;\">0.057</td>\n",
       "<td style=\"font-family: monospace !important;\">0.033</td>\n",
       "<td style=\"font-family: monospace !important;\">0.000</td>\n",
       "<td style=\"font-family: monospace !important;\">0.051</td>\n",
       "<td style=\"font-family: monospace !important;\">0.045</td>\n",
       "<td style=\"font-family: monospace !important;\">0.060</td>\n",
       "<td style=\"font-family: monospace !important;\">0.033</td>\n",
       "<td style=\"font-family: monospace !important;\">0.046</td>\n",
       "<td style=\"font-family: monospace !important;\">0.040</td>\n",
       "<td style=\"font-family: monospace !important;\">0.032</td>\n",
       "<td style=\"font-family: monospace !important;\">0.030</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">2b</td>\n",
       "<td style=\"font-family: monospace !important;\">0.612</td>\n",
       "<td style=\"font-family: monospace !important;\">0.654</td>\n",
       "<td style=\"font-family: monospace !important;\">0.706</td>\n",
       "<td style=\"font-family: monospace !important;\">0.623</td>\n",
       "<td style=\"font-family: monospace !important;\">0.634</td>\n",
       "<td style=\"font-family: monospace !important;\">0.607</td>\n",
       "<td style=\"font-family: monospace !important;\">0.653</td>\n",
       "<td style=\"font-family: monospace !important;\">0.631</td>\n",
       "<td style=\"font-family: monospace !important;\">0.642</td>\n",
       "<td style=\"font-family: monospace !important;\">0.656</td>\n",
       "<td style=\"font-family: monospace !important;\">0.658</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></th>\n",
       "<th>11</th>\n",
       "<th>12</th>\n",
       "<th>13</th>\n",
       "<th>14</th>\n",
       "<th>15</th>\n",
       "<th>16</th>\n",
       "<th>17</th>\n",
       "<th>18</th>\n",
       "<th>19</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">0</td>\n",
       "<td style=\"font-family: monospace !important;\">0.080</td>\n",
       "<td style=\"font-family: monospace !important;\">0.048</td>\n",
       "<td style=\"font-family: monospace !important;\">0.000</td>\n",
       "<td style=\"font-family: monospace !important;\">0.079</td>\n",
       "<td style=\"font-family: monospace !important;\">0.261</td>\n",
       "<td style=\"font-family: monospace !important;\">0.041</td>\n",
       "<td style=\"font-family: monospace !important;\">0.035</td>\n",
       "<td style=\"font-family: monospace !important;\">0.058</td>\n",
       "<td style=\"font-family: monospace !important;\">0.062</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">1</td>\n",
       "<td style=\"font-family: monospace !important;\">0.253</td>\n",
       "<td style=\"font-family: monospace !important;\">0.268</td>\n",
       "<td style=\"font-family: monospace !important;\">0.293</td>\n",
       "<td style=\"font-family: monospace !important;\">0.253</td>\n",
       "<td style=\"font-family: monospace !important;\">0.157</td>\n",
       "<td style=\"font-family: monospace !important;\">0.271</td>\n",
       "<td style=\"font-family: monospace !important;\">0.274</td>\n",
       "<td style=\"font-family: monospace !important;\">0.263</td>\n",
       "<td style=\"font-family: monospace !important;\">0.262</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">2a</td>\n",
       "<td style=\"font-family: monospace !important;\">0.060</td>\n",
       "<td style=\"font-family: monospace !important;\">0.037</td>\n",
       "<td style=\"font-family: monospace !important;\">0.000</td>\n",
       "<td style=\"font-family: monospace !important;\">0.060</td>\n",
       "<td style=\"font-family: monospace !important;\">0.203</td>\n",
       "<td style=\"font-family: monospace !important;\">0.032</td>\n",
       "<td style=\"font-family: monospace !important;\">0.028</td>\n",
       "<td style=\"font-family: monospace !important;\">0.045</td>\n",
       "<td style=\"font-family: monospace !important;\">0.047</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">2b</td>\n",
       "<td style=\"font-family: monospace !important;\">0.607</td>\n",
       "<td style=\"font-family: monospace !important;\">0.647</td>\n",
       "<td style=\"font-family: monospace !important;\">0.707</td>\n",
       "<td style=\"font-family: monospace !important;\">0.607</td>\n",
       "<td style=\"font-family: monospace !important;\">0.379</td>\n",
       "<td style=\"font-family: monospace !important;\">0.656</td>\n",
       "<td style=\"font-family: monospace !important;\">0.663</td>\n",
       "<td style=\"font-family: monospace !important;\">0.634</td>\n",
       "<td style=\"font-family: monospace !important;\">0.630</td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "==========================================================================================================================================================================================================\n",
       "           0         1         2         3         4         5         6         7         8         9        10        11        12        13        14        15        16        17        18        19\n",
       "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n",
       " 0    0.0756    0.0426    0.0000    0.0668    0.0584    0.0798    0.0428    0.0606    0.0517    0.0409    0.0390    0.0798    0.0478    0.0000    0.0794    0.2608    0.0409    0.0354    0.0584    0.0617\n",
       " 1    0.2552    0.2706    0.2935    0.2594    0.2633    0.2532    0.2705    0.2623    0.2664    0.2712    0.2722    0.2532    0.2682    0.2932    0.2534    0.1567    0.2712    0.2739    0.2633    0.2617\n",
       "2a    0.0570    0.0330    0.0000    0.0507    0.0446    0.0600    0.0332    0.0462    0.0397    0.0319    0.0304    0.0600    0.0369    0.0000    0.0598    0.2033    0.0319    0.0277    0.0446    0.0471\n",
       "2b    0.6122    0.6538    0.7065    0.6232    0.6337    0.6070    0.6535    0.6310    0.6422    0.6560    0.6583    0.6070    0.6471    0.7068    0.6075    0.3791    0.6560    0.6630    0.6337    0.6295\n",
       "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bprobs = result.alt.lf.get_bin_probs()\n",
    "bprobs[:, :20]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Getting all the statistics in tabular form"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5x tabular_result('global params': Table, 'bin params': Table, 'edge params': Table, 'edge bin params': Table)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tab = evo.tabulate_stats()\n",
    "stats = tab(result.alt)\n",
    "stats"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "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;\">edge bin 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>bin</th>\n",
       "<th>omega</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Galago</td>\n",
       "<td style=\"font-family: monospace !important;\">0</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;\">Galago</td>\n",
       "<td style=\"font-family: monospace !important;\">1</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Galago</td>\n",
       "<td>2a</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;\">Galago</td>\n",
       "<td>2b</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">HowlerMon</td>\n",
       "<td style=\"font-family: monospace !important;\">0</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;\">HowlerMon</td>\n",
       "<td style=\"font-family: monospace !important;\">1</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">HowlerMon</td>\n",
       "<td>2a</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;\">HowlerMon</td>\n",
       "<td>2b</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">Rhesus</td>\n",
       "<td style=\"font-family: monospace !important;\">0</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;\">Rhesus</td>\n",
       "<td style=\"font-family: monospace !important;\">1</td>\n",
       "<td style=\"font-family: monospace !important;\">1.0000</td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n",
       "<p>\n",
       "10 rows x 3 columns</p>"
      ],
      "text/plain": [
       "edge bin params\n",
       "==========================\n",
       "     edge    bin     omega\n",
       "--------------------------\n",
       "   Galago      0    0.0000\n",
       "   Galago      1    1.0000\n",
       "   Galago     2a    0.0000\n",
       "   Galago     2b    1.0000\n",
       "HowlerMon      0    0.0000\n",
       "HowlerMon      1    1.0000\n",
       "HowlerMon     2a    0.0000\n",
       "HowlerMon     2b    1.0000\n",
       "   Rhesus      0    0.0000\n",
       "   Rhesus      1    1.0000\n",
       "--------------------------\n",
       "\n",
       "10 rows x 3 columns"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stats[\"edge bin params\"][:10]  # truncating the table"
   ]
  }
 ],
 "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.7.3"
  },
  "widgets": {
   "application/vnd.jupyter.widget-state+json": {
    "state": {},
    "version_major": 2,
    "version_minor": 0
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
