{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## What apps are there?\n",
    "\n",
    "Apps perform functions ranging from multiple sequence alignment (e.g. `progressive_align`), to excluding alignment columns containing non-nucleotide characters (e.g. `omit_degenerates`) to performing maximum-likelihood evolutionary analyses (e.g. `model`).\n",
    "\n",
    "Apps that are identified as \"composable\" (with a value of `True` under that clumn) can be combined into a single function by addition."
   ]
  },
  {
   "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",
       "<thead style=\"background: rgba(161, 195, 209, 0.75); font-weight: bold; text-align: center;\">\n",
       "<th>module</th>\n",
       "<th>name</th>\n",
       "<th>composable</th>\n",
       "<th>doc</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td>cogent3.app.align</td>\n",
       "<td>align_to_ref</td>\n",
       "<td>True</td>\n",
       "<td>Aligns to a reference seq, no gaps in the reference.\n",
       "    Returns an Alignment object.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.align</td>\n",
       "<td>progressive_align</td>\n",
       "<td>True</td>\n",
       "<td>Progressive multiple sequence alignment via any cogent3 model.\n",
       "     Returns an Alignment object.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.dist</td>\n",
       "<td>fast_slow_dist</td>\n",
       "<td>True</td>\n",
       "<td>Pairwise distance calculation. Uses fast (but less\n",
       "    numerically robust) approach where possible, slow (robust)\n",
       "    approach when not. Returns a DistanceMatrix.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.evo</td>\n",
       "<td>ancestral_states</td>\n",
       "<td>True</td>\n",
       "<td>Computes ancestral state probabilities from a model result. Returns a dict\n",
       "    with a DictArray for each node.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.evo</td>\n",
       "<td>bootstrap</td>\n",
       "<td>True</td>\n",
       "<td>Parametric bootstrap for a provided hypothesis. Returns a bootstrap_result.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.evo</td>\n",
       "<td>hypothesis</td>\n",
       "<td>True</td>\n",
       "<td>Specify a hypothesis through defining two models. Returns a\n",
       "    hypothesis_result.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.evo</td>\n",
       "<td>model</td>\n",
       "<td>True</td>\n",
       "<td>Define a substitution model + tree for maximum likelihood evaluation.\n",
       "    Returns model_result.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.evo</td>\n",
       "<td>natsel_neutral</td>\n",
       "<td>True</td>\n",
       "<td>Test of selective neutrality by assessing whether omega equals 1.\n",
       "    Under the alternate, there is one omega for all branches and all sites.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.evo</td>\n",
       "<td>natsel_sitehet</td>\n",
       "<td>True</td>\n",
       "<td>Test for site-heterogeneity in omega. Under null, there are 2 site-classes,\n",
       "    omega &lt; 1 and omega = 1. Under the alternate, an additional site-class of\n",
       "    omega &gt; 1 is added.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.evo</td>\n",
       "<td>natsel_timehet</td>\n",
       "<td>True</td>\n",
       "<td>The branch heterogeneity hypothesis test for natural selection.\n",
       "    Tests for whether a single omega for all branches is sufficient against the\n",
       "    alternate that a user specified subset of branches have a distinct value\n",
       "    (or values) of omega.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.evo</td>\n",
       "<td>natsel_zhang</td>\n",
       "<td>True</td>\n",
       "<td>The branch by site-class hypothesis test for natural selection of\n",
       "    Zhang et al MBE 22: 2472-2479.\n",
       "\n",
       "    Note: Our implementation is not as parametrically succinct as that of\n",
       "    Zhang et al, we have 1 additional bin probability.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.evo</td>\n",
       "<td>tabulate_stats</td>\n",
       "<td>True</td>\n",
       "<td>Extracts all model statistics from model_result as Table.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.io</td>\n",
       "<td>load_aligned</td>\n",
       "<td>True</td>\n",
       "<td>Loads aligned sequences. Returns an Alignment object.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.io</td>\n",
       "<td>load_db</td>\n",
       "<td>True</td>\n",
       "<td>Loads json serialised cogent3 objects from a TinyDB file. \n",
       "    Returns whatever object type was stored.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.io</td>\n",
       "<td>load_json</td>\n",
       "<td>True</td>\n",
       "<td>Loads json serialised cogent3 objects from a json file. \n",
       "    Returns whatever object type was stored.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.io</td>\n",
       "<td>load_tabular</td>\n",
       "<td>True</td>\n",
       "<td>Loads delimited data. Returns a Table.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.io</td>\n",
       "<td>load_unaligned</td>\n",
       "<td>True</td>\n",
       "<td>Loads unaligned sequences. Returns a SequenceCollection.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.io</td>\n",
       "<td>write_db</td>\n",
       "<td>True</td>\n",
       "<td>Writes json serialised objects to a TinyDB instance.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.io</td>\n",
       "<td>write_json</td>\n",
       "<td>True</td>\n",
       "<td>Writes json serialised objects to individual json files.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.io</td>\n",
       "<td>write_seqs</td>\n",
       "<td>True</td>\n",
       "<td>Writes sequences to text files in standard format.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.io</td>\n",
       "<td>write_tabular</td>\n",
       "<td>True</td>\n",
       "<td>writes tabular data</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.sample</td>\n",
       "<td>concat</td>\n",
       "<td>False</td>\n",
       "<td>Creates a concatenated alignment from a series. Returns an Alignment.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.sample</td>\n",
       "<td>fixed_length</td>\n",
       "<td>True</td>\n",
       "<td>Sample an alignment to a fixed length. Returns an Alignment of the \n",
       "    specified length, or NotCompleted if alignment too short.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.sample</td>\n",
       "<td>min_length</td>\n",
       "<td>True</td>\n",
       "<td>Filters sequence collections / alignments by length. Returns the \n",
       "    data if it satisfies the condition, NotCompleted otherwise.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.sample</td>\n",
       "<td>omit_bad_seqs</td>\n",
       "<td>True</td>\n",
       "<td>Eliminates sequences from Alignment based on gap fraction, unique gaps.\n",
       "    Returns modified alignment.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.sample</td>\n",
       "<td>omit_degenerates</td>\n",
       "<td>True</td>\n",
       "<td>Excludes alignment columns with degenerate conditions. Can accomodate\n",
       "    reading frame. Returns modified Alignment.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.sample</td>\n",
       "<td>omit_duplicated</td>\n",
       "<td>True</td>\n",
       "<td>Removes redundant sequences, recording dropped sequences in\n",
       "    seqs.info.dropped. Returns sequence collection with only unique sequences.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.sample</td>\n",
       "<td>omit_gap_pos</td>\n",
       "<td>True</td>\n",
       "<td>Excludes gapped alignment columns meeting a threshold. Can accomodate\n",
       "    reading frame. Returns modified Alignment.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.sample</td>\n",
       "<td>take_codon_positions</td>\n",
       "<td>True</td>\n",
       "<td>Extracts the specified codon position(s) from an alignment. \n",
       "    Returns an Alignment.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.sample</td>\n",
       "<td>take_named_seqs</td>\n",
       "<td>True</td>\n",
       "<td>Extracts (or everything but) named sequences. Returns a filtered\n",
       "    sequences, alignment that satisified the condition, NotCompleted otherwise.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.sample</td>\n",
       "<td>trim_stop_codons</td>\n",
       "<td>True</td>\n",
       "<td>Removes terminal stop codons. Returns sequences / alignment.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.translate</td>\n",
       "<td>select_translatable</td>\n",
       "<td>True</td>\n",
       "<td>Identifies most likely reading frame. Returns modified sequences / alignment,\n",
       "    if it could be resolved, NotCompleted otherwise.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.tree</td>\n",
       "<td>quick_tree</td>\n",
       "<td>True</td>\n",
       "<td>Neighbour Joining tree based on pairwise distances.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.tree</td>\n",
       "<td>scale_branches</td>\n",
       "<td>True</td>\n",
       "<td>Transforms tree branch lengths from nucleotide to codon, or the converse.\n",
       "    Returns a Tree.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.tree</td>\n",
       "<td>uniformize_tree</td>\n",
       "<td>True</td>\n",
       "<td>Standardises the orientation of unrooted trees. Returns a Tree.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>cogent3.app.composable</td>\n",
       "<td>user_function</td>\n",
       "<td>True</td>\n",
       "<td>wrapper class for user specified function</td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n",
       "<p>\n",
       "36 rows x 4 columns</p>"
      ],
      "text/plain": [
       "===========================================================================================================================================================================================================================================================================================================================\n",
       "                module                    name    composable                                                                                                                                                                                                                                                            doc\n",
       "---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n",
       "     cogent3.app.align            align_to_ref          True                                                                                                                                                                          Aligns to a reference seq, no gaps in the reference.\n",
       "    Returns an Alignment object.\n",
       "     cogent3.app.align       progressive_align          True                                                                                                                                                               Progressive multiple sequence alignment via any cogent3 model.\n",
       "     Returns an Alignment object.\n",
       "      cogent3.app.dist          fast_slow_dist          True                                                                                             Pairwise distance calculation. Uses fast (but less\n",
       "    numerically robust) approach where possible, slow (robust)\n",
       "    approach when not. Returns a DistanceMatrix.\n",
       "       cogent3.app.evo        ancestral_states          True                                                                                                                                                 Computes ancestral state probabilities from a model result. Returns a dict\n",
       "    with a DictArray for each node.\n",
       "       cogent3.app.evo               bootstrap          True                                                                                                                                                                                    Parametric bootstrap for a provided hypothesis. Returns a bootstrap_result.\n",
       "       cogent3.app.evo              hypothesis          True                                                                                                                                                                             Specify a hypothesis through defining two models. Returns a\n",
       "    hypothesis_result.\n",
       "       cogent3.app.evo                   model          True                                                                                                                                                                Define a substitution model + tree for maximum likelihood evaluation.\n",
       "    Returns model_result.\n",
       "       cogent3.app.evo          natsel_neutral          True                                                                                                             Test of selective neutrality by assessing whether omega equals 1.\n",
       "    Under the alternate, there is one omega for all branches and all sites.\n",
       "    \n",
       "       cogent3.app.evo          natsel_sitehet          True                                                                              Test for site-heterogeneity in omega. Under null, there are 2 site-classes,\n",
       "    omega < 1 and omega = 1. Under the alternate, an additional site-class of\n",
       "    omega > 1 is added.\n",
       "       cogent3.app.evo          natsel_timehet          True    The branch heterogeneity hypothesis test for natural selection.\n",
       "    Tests for whether a single omega for all branches is sufficient against the\n",
       "    alternate that a user specified subset of branches have a distinct value\n",
       "    (or values) of omega.\n",
       "    \n",
       "       cogent3.app.evo            natsel_zhang          True                    The branch by site-class hypothesis test for natural selection of\n",
       "    Zhang et al MBE 22: 2472-2479.\n",
       "\n",
       "    Note: Our implementation is not as parametrically succinct as that of\n",
       "    Zhang et al, we have 1 additional bin probability.\n",
       "    \n",
       "       cogent3.app.evo          tabulate_stats          True                                                                                                                                                                                                      Extracts all model statistics from model_result as Table.\n",
       "        cogent3.app.io            load_aligned          True                                                                                                                                                                                                          Loads aligned sequences. Returns an Alignment object.\n",
       "        cogent3.app.io                 load_db          True                                                                                                                                                        Loads json serialised cogent3 objects from a TinyDB file. \n",
       "    Returns whatever object type was stored.\n",
       "        cogent3.app.io               load_json          True                                                                                                                                                          Loads json serialised cogent3 objects from a json file. \n",
       "    Returns whatever object type was stored.\n",
       "        cogent3.app.io            load_tabular          True                                                                                                                                                                                                                         Loads delimited data. Returns a Table.\n",
       "        cogent3.app.io          load_unaligned          True                                                                                                                                                                                                       Loads unaligned sequences. Returns a SequenceCollection.\n",
       "        cogent3.app.io                write_db          True                                                                                                                                                                                                           Writes json serialised objects to a TinyDB instance.\n",
       "        cogent3.app.io              write_json          True                                                                                                                                                                                                       Writes json serialised objects to individual json files.\n",
       "        cogent3.app.io              write_seqs          True                                                                                                                                                                                                             Writes sequences to text files in standard format.\n",
       "        cogent3.app.io           write_tabular          True                                                                                                                                                                                                                                            writes tabular data\n",
       "    cogent3.app.sample                  concat         False                                                                                                                                                                                          Creates a concatenated alignment from a series. Returns an Alignment.\n",
       "    cogent3.app.sample            fixed_length          True                                                                                                                              Sample an alignment to a fixed length. Returns an Alignment of the \n",
       "    specified length, or NotCompleted if alignment too short.\n",
       "    cogent3.app.sample              min_length          True                                                                                                                              Filters sequence collections / alignments by length. Returns the \n",
       "    data if it satisfies the condition, NotCompleted otherwise.\n",
       "    cogent3.app.sample           omit_bad_seqs          True                                                                                                                                                        Eliminates sequences from Alignment based on gap fraction, unique gaps.\n",
       "    Returns modified alignment.\n",
       "    cogent3.app.sample        omit_degenerates          True                                                                                                                                           Excludes alignment columns with degenerate conditions. Can accomodate\n",
       "    reading frame. Returns modified Alignment.\n",
       "    cogent3.app.sample         omit_duplicated          True                                                                                                                     Removes redundant sequences, recording dropped sequences in\n",
       "    seqs.info.dropped. Returns sequence collection with only unique sequences.\n",
       "    cogent3.app.sample            omit_gap_pos          True                                                                                                                                           Excludes gapped alignment columns meeting a threshold. Can accomodate\n",
       "    reading frame. Returns modified Alignment.\n",
       "    cogent3.app.sample    take_codon_positions          True                                                                                                                                                                         Extracts the specified codon position(s) from an alignment. \n",
       "    Returns an Alignment.\n",
       "    cogent3.app.sample         take_named_seqs          True                                                                                                               Extracts (or everything but) named sequences. Returns a filtered\n",
       "    sequences, alignment that satisified the condition, NotCompleted otherwise.\n",
       "    cogent3.app.sample        trim_stop_codons          True                                                                                                                                                                                                   Removes terminal stop codons. Returns sequences / alignment.\n",
       " cogent3.app.translate     select_translatable          True                                                                                                                             Identifies most likely reading frame. Returns modified sequences / alignment,\n",
       "    if it could be resolved, NotCompleted otherwise.\n",
       "      cogent3.app.tree              quick_tree          True                                                                                                                                                                                                            Neighbour Joining tree based on pairwise distances.\n",
       "      cogent3.app.tree          scale_branches          True                                                                                                                                                                  Transforms tree branch lengths from nucleotide to codon, or the converse.\n",
       "    Returns a Tree.\n",
       "      cogent3.app.tree         uniformize_tree          True                                                                                                                                                                                                Standardises the orientation of unrooted trees. Returns a Tree.\n",
       "cogent3.app.composable           user_function          True                                                                                                                                                                                                                      wrapper class for user specified function\n",
       "---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n",
       "\n",
       "36 rows x 4 columns"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from cogent3 import available_apps\n",
    "\n",
    "available_apps()"
   ]
  }
 ],
 "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
}
