{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Available genetic codes"
   ]
  },
  {
   "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 genetic code using either 'Name' or Code ID (as an integer or string)</span><span></span></caption>\n",
       "<thead style=\"background: rgba(161, 195, 209, 0.75); font-weight: bold; text-align: center;\">\n",
       "<th>Code ID</th>\n",
       "<th>Name</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">1</td>\n",
       "<td>Standard Nuclear</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">2</td>\n",
       "<td>Vertebrate Mitochondrial</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">3</td>\n",
       "<td>Yeast Mitochondrial</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">4</td>\n",
       "<td>Mold, Protozoan, and Coelenterate Mitochondrial, and Mycoplasma/Spiroplasma Nuclear</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">5</td>\n",
       "<td>Invertebrate Mitochondrial</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">6</td>\n",
       "<td>Ciliate, Dasycladacean and Hexamita Nuclear</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">9</td>\n",
       "<td>Echinoderm and Flatworm Mitochondrial</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">10</td>\n",
       "<td>Euplotid Nuclear</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">11</td>\n",
       "<td>Bacterial Nuclear and Plant Plastid</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">12</td>\n",
       "<td>Alternative Yeast Nuclear</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">13</td>\n",
       "<td>Ascidian Mitochondrial</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">14</td>\n",
       "<td>Alternative Flatworm Mitochondrial</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">15</td>\n",
       "<td>Blepharisma Nuclear</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">16</td>\n",
       "<td>Chlorophycean Mitochondrial</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">20</td>\n",
       "<td>Trematode Mitochondrial</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">22</td>\n",
       "<td>Scenedesmus obliquus Mitochondrial</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td style=\"background: rgba(161, 195, 209, 0.25); font-weight: 600;\">23</td>\n",
       "<td>Thraustochytrium Mitochondrial</td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n",
       "<p>\n",
       "17 rows x 2 columns</p>"
      ],
      "text/plain": [
       "Specify a genetic code using either 'Name' or Code ID (as an integer or string)\n",
       "==============================================================================================\n",
       "Code ID                                                                                   Name\n",
       "----------------------------------------------------------------------------------------------\n",
       "      1                                                                       Standard Nuclear\n",
       "      2                                                               Vertebrate Mitochondrial\n",
       "      3                                                                    Yeast Mitochondrial\n",
       "      4    Mold, Protozoan, and Coelenterate Mitochondrial, and Mycoplasma/Spiroplasma Nuclear\n",
       "      5                                                             Invertebrate Mitochondrial\n",
       "      6                                            Ciliate, Dasycladacean and Hexamita Nuclear\n",
       "      9                                                  Echinoderm and Flatworm Mitochondrial\n",
       "     10                                                                       Euplotid Nuclear\n",
       "     11                                                    Bacterial Nuclear and Plant Plastid\n",
       "     12                                                              Alternative Yeast Nuclear\n",
       "     13                                                                 Ascidian Mitochondrial\n",
       "     14                                                     Alternative Flatworm Mitochondrial\n",
       "     15                                                                    Blepharisma Nuclear\n",
       "     16                                                            Chlorophycean Mitochondrial\n",
       "     20                                                                Trematode Mitochondrial\n",
       "     22                                                     Scenedesmus obliquus Mitochondrial\n",
       "     23                                                         Thraustochytrium Mitochondrial\n",
       "----------------------------------------------------------------------------------------------\n",
       "\n",
       "17 rows x 2 columns"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from cogent3 import available_codes\n",
    "\n",
    "available_codes()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In cases where a ``cogent3`` object method has a `gc` argument, you can just use the number under \"Code ID\" column.\n",
    "\n",
    "For example:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style>\n",
       "tr { line-height: 3pt ; }\n",
       ".blank_row{ line-height: 12pt !important; opacity: 0.10; }\n",
       "td { border: none !important; text-align: left !important; }\n",
       ".label { font-size: 12pt ; text-align: right !important; color: black !important; }\n",
       ".T_dna{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: blue; }\n",
       ".C_dna{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: black; }\n",
       ".A_dna{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: #FF0102; }\n",
       ".G_dna{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: green; }\n",
       ".terminal_ambig_dna{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: gray; }\n",
       ".ambig_dna{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: gray; }\n",
       "</style>\n",
       "<body>\n",
       "<table>\n",
       "<tr style=\"background-color:rgba(161, 195, 209, 0.5);\"><td></td><td><b>0</b></td></tr>\n",
       "<tr><td class=\"label\">TombBat</td><td><span class=\"T_dna\">T</span><span class=\"G_dna\">G</span><span class=\"T_dna\">T</span><span class=\"G_dna\">G</span><span class=\"G_dna\">G</span><span class=\"C_dna\">C</span><span class=\"A_dna\">A</span><span class=\"C_dna\">C</span><span class=\"A_dna\">A</span><span class=\"A_dna\">A</span><span class=\"G_dna\">G</span><span class=\"T_dna\">T</span><span class=\"A_dna\">A</span><span class=\"C_dna\">C</span><span class=\"T_dna\">T</span><span class=\"C_dna\">C</span><span class=\"A_dna\">A</span><span class=\"T_dna\">T</span><span class=\"G_dna\">G</span><span class=\"C_dna\">C</span><span class=\"C_dna\">C</span></td></tr>\n",
       "<tr><td class=\"label\">FlyingFox</td><td><span class=\"T_dna\">.</span><span class=\"G_dna\">.</span><span class=\"T_dna\">.</span><span class=\"G_dna\">.</span><span class=\"G_dna\">.</span><span class=\"C_dna\">.</span><span class=\"A_dna\">.</span><span class=\"C_dna\">.</span><span class=\"A_dna\">.</span><span class=\"A_dna\">.</span><span class=\"A_dna\">A</span><span class=\"T_dna\">.</span><span class=\"G_dna\">G</span><span class=\"C_dna\">.</span><span class=\"T_dna\">.</span><span class=\"C_dna\">.</span><span class=\"A_dna\">.</span><span class=\"T_dna\">.</span><span class=\"G_dna\">.</span><span class=\"C_dna\">.</span><span class=\"C_dna\">.</span></td></tr>\n",
       "<tr><td class=\"label\">DogFaced</td><td><span class=\"T_dna\">.</span><span class=\"G_dna\">.</span><span class=\"T_dna\">.</span><span class=\"G_dna\">.</span><span class=\"G_dna\">.</span><span class=\"C_dna\">.</span><span class=\"A_dna\">.</span><span class=\"C_dna\">.</span><span class=\"A_dna\">.</span><span class=\"A_dna\">.</span><span class=\"A_dna\">A</span><span class=\"T_dna\">.</span><span class=\"A_dna\">.</span><span class=\"C_dna\">.</span><span class=\"T_dna\">.</span><span class=\"C_dna\">.</span><span class=\"A_dna\">.</span><span class=\"T_dna\">.</span><span class=\"G_dna\">.</span><span class=\"C_dna\">.</span><span class=\"C_dna\">.</span></td></tr>\n",
       "<tr><td class=\"label\">FreeTaile</td><td><span class=\"T_dna\">.</span><span class=\"G_dna\">.</span><span class=\"T_dna\">.</span><span class=\"G_dna\">.</span><span class=\"G_dna\">.</span><span class=\"C_dna\">.</span><span class=\"A_dna\">.</span><span class=\"C_dna\">.</span><span class=\"A_dna\">.</span><span class=\"G_dna\">G</span><span class=\"A_dna\">A</span><span class=\"T_dna\">.</span><span class=\"A_dna\">.</span><span class=\"C_dna\">.</span><span class=\"T_dna\">.</span><span class=\"C_dna\">.</span><span class=\"A_dna\">.</span><span class=\"T_dna\">.</span><span class=\"G_dna\">.</span><span class=\"C_dna\">.</span><span class=\"C_dna\">.</span></td></tr>\n",
       "<tr><td class=\"label\">LittleBro</td><td><span class=\"T_dna\">.</span><span class=\"G_dna\">.</span><span class=\"T_dna\">.</span><span class=\"G_dna\">.</span><span class=\"G_dna\">.</span><span class=\"C_dna\">.</span><span class=\"A_dna\">.</span><span class=\"C_dna\">.</span><span class=\"A_dna\">.</span><span class=\"G_dna\">G</span><span class=\"A_dna\">A</span><span class=\"T_dna\">.</span><span class=\"A_dna\">.</span><span class=\"C_dna\">.</span><span class=\"T_dna\">.</span><span class=\"C_dna\">.</span><span class=\"A_dna\">.</span><span class=\"T_dna\">.</span><span class=\"G_dna\">.</span><span class=\"C_dna\">.</span><span class=\"C_dna\">.</span></td></tr>\n",
       "</table>\n",
       "<p><i>5 x 21 dna alignment</i></p>\n",
       "</body>"
      ],
      "text/plain": [
       "5 x 21 dna alignment: FlyingFox[TGTGGCACAAA...], DogFaced[TGTGGCACAAA...], FreeTaile[TGTGGCACAGA...], ..."
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from cogent3 import load_aligned_seqs\n",
    "\n",
    "nt_seqs = load_aligned_seqs(\"../data/brca1-bats.fasta\", moltype=\"dna\")\n",
    "nt_seqs[:21]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We specify the genetic code, and that codons that are incomplete as they contain a gap, are converted to `?`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style>\n",
       "tr { line-height: 3pt ; }\n",
       ".blank_row{ line-height: 12pt !important; opacity: 0.10; }\n",
       "td { border: none !important; text-align: left !important; }\n",
       ".label { font-size: 12pt ; text-align: right !important; color: black !important; }\n",
       ".A_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: #009999; }\n",
       ".C_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: orange; }\n",
       ".D_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: blue; }\n",
       ".E_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: blue; }\n",
       ".F_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: #ff6600; }\n",
       ".G_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: #009999; }\n",
       ".H_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: #FF0102; }\n",
       ".I_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: #009999; }\n",
       ".K_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: #FF0102; }\n",
       ".L_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: #009999; }\n",
       ".M_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: orange; }\n",
       ".N_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: #993300; }\n",
       ".P_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: #cc0099; }\n",
       ".Q_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: #993300; }\n",
       ".R_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: #FF0102; }\n",
       ".S_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: #009900; }\n",
       ".T_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: #009900; }\n",
       ".U_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: gray; }\n",
       ".V_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: #009999; }\n",
       ".W_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: #ff6600; }\n",
       ".Y_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: #ff6600; }\n",
       ".terminal_ambig_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: gray; }\n",
       ".ambig_protein{font-family: \"Lucida Console\",monospace !important; font-size: 12pt !important; color: gray; }\n",
       "</style>\n",
       "<body>\n",
       "<table>\n",
       "<tr style=\"background-color:rgba(161, 195, 209, 0.5);\"><td></td><td><b>0</b></td></tr>\n",
       "<tr><td class=\"label\">TombBat</td><td><span class=\"C_protein\">C</span><span class=\"G_protein\">G</span><span class=\"T_protein\">T</span><span class=\"S_protein\">S</span><span class=\"T_protein\">T</span><span class=\"H_protein\">H</span><span class=\"A_protein\">A</span><span class=\"S_protein\">S</span><span class=\"S_protein\">S</span><span class=\"V_protein\">V</span><span class=\"Q_protein\">Q</span><span class=\"H_protein\">H</span><span class=\"E_protein\">E</span><span class=\"N_protein\">N</span><span class=\"S_protein\">S</span><span class=\"S_protein\">S</span><span class=\"L_protein\">L</span><span class=\"L_protein\">L</span><span class=\"L_protein\">L</span><span class=\"T_protein\">T</span></td></tr>\n",
       "<tr><td class=\"label\">FlyingFox</td><td><span class=\"C_protein\">.</span><span class=\"G_protein\">.</span><span class=\"T_protein\">.</span><span class=\"N_protein\">N</span><span class=\"A_protein\">A</span><span class=\"H_protein\">.</span><span class=\"A_protein\">.</span><span class=\"S_protein\">.</span><span class=\"S_protein\">.</span><span class=\"L_protein\">L</span><span class=\"Q_protein\">.</span><span class=\"H_protein\">.</span><span class=\"E_protein\">.</span><span class=\"N_protein\">.</span><span class=\"ambig_protein\">-</span><span class=\"S_protein\">.</span><span class=\"L_protein\">.</span><span class=\"L_protein\">.</span><span class=\"Y_protein\">Y</span><span class=\"T_protein\">.</span></td></tr>\n",
       "<tr><td class=\"label\">DogFaced</td><td><span class=\"C_protein\">.</span><span class=\"G_protein\">.</span><span class=\"T_protein\">.</span><span class=\"N_protein\">N</span><span class=\"T_protein\">.</span><span class=\"H_protein\">.</span><span class=\"A_protein\">.</span><span class=\"N_protein\">N</span><span class=\"S_protein\">.</span><span class=\"L_protein\">L</span><span class=\"Q_protein\">.</span><span class=\"H_protein\">.</span><span class=\"E_protein\">.</span><span class=\"N_protein\">.</span><span class=\"S_protein\">.</span><span class=\"S_protein\">.</span><span class=\"L_protein\">.</span><span class=\"L_protein\">.</span><span class=\"Y_protein\">Y</span><span class=\"T_protein\">.</span></td></tr>\n",
       "<tr><td class=\"label\">FreeTaile</td><td><span class=\"C_protein\">.</span><span class=\"G_protein\">.</span><span class=\"T_protein\">.</span><span class=\"D_protein\">D</span><span class=\"T_protein\">.</span><span class=\"H_protein\">.</span><span class=\"A_protein\">.</span><span class=\"S_protein\">.</span><span class=\"S_protein\">.</span><span class=\"L_protein\">L</span><span class=\"Q_protein\">.</span><span class=\"H_protein\">.</span><span class=\"E_protein\">.</span><span class=\"N_protein\">.</span><span class=\"S_protein\">.</span><span class=\"S_protein\">.</span><span class=\"L_protein\">.</span><span class=\"L_protein\">.</span><span class=\"L_protein\">.</span><span class=\"T_protein\">.</span></td></tr>\n",
       "<tr><td class=\"label\">LittleBro</td><td><span class=\"C_protein\">.</span><span class=\"G_protein\">.</span><span class=\"T_protein\">.</span><span class=\"D_protein\">D</span><span class=\"T_protein\">.</span><span class=\"H_protein\">.</span><span class=\"A_protein\">.</span><span class=\"S_protein\">.</span><span class=\"S_protein\">.</span><span class=\"L_protein\">L</span><span class=\"Q_protein\">.</span><span class=\"H_protein\">.</span><span class=\"E_protein\">.</span><span class=\"N_protein\">.</span><span class=\"S_protein\">.</span><span class=\"S_protein\">.</span><span class=\"L_protein\">.</span><span class=\"L_protein\">.</span><span class=\"L_protein\">.</span><span class=\"T_protein\">.</span></td></tr>\n",
       "</table>\n",
       "<p><i>5 x 20 protein alignment</i></p>\n",
       "</body>"
      ],
      "text/plain": [
       "5 x 20 protein alignment: FlyingFox[CGTNAHASSLQ...], DogFaced[CGTNTHANSLQ...], FreeTaile[CGTDTHASSLQ...], ..."
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "aa_seqs = nt_seqs.get_translation(gc=1, incomplete_ok=True)\n",
    "aa_seqs[:20]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Getting a genetic code with `get_code()`\n",
    "\n",
    "This function can be used directly to get a genetic code. We will get the code with ID 4."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "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;\">Mold, Protozoan, and Coelenterate Mitochondrial, and Mycoplasma/Spiroplasma Nuclear</span><span></span></caption>\n",
       "<thead style=\"background: rgba(161, 195, 209, 0.75); font-weight: bold; text-align: center;\">\n",
       "<th>aa</th>\n",
       "<th>IUPAC code</th>\n",
       "<th>codons</th>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr>\n",
       "<td>Alanine</td>\n",
       "<td>A</td>\n",
       "<td>GCT,GCC,GCA,GCG</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Cysteine</td>\n",
       "<td>C</td>\n",
       "<td>TGT,TGC</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Aspartic Acid</td>\n",
       "<td>D</td>\n",
       "<td>GAT,GAC</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Glutamic Acid</td>\n",
       "<td>E</td>\n",
       "<td>GAA,GAG</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Phenylalanine</td>\n",
       "<td>F</td>\n",
       "<td>TTT,TTC</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Glycine</td>\n",
       "<td>G</td>\n",
       "<td>GGT,GGC,GGA,GGG</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Histidine</td>\n",
       "<td>H</td>\n",
       "<td>CAT,CAC</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Isoleucine</td>\n",
       "<td>I</td>\n",
       "<td>ATT,ATC,ATA</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Lysine</td>\n",
       "<td>K</td>\n",
       "<td>AAA,AAG</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Leucine</td>\n",
       "<td>L</td>\n",
       "<td>TTA,TTG,CTT,CTC,CTA,CTG</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Methionine</td>\n",
       "<td>M</td>\n",
       "<td>ATG</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Asparagine</td>\n",
       "<td>N</td>\n",
       "<td>AAT,AAC</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Proline</td>\n",
       "<td>P</td>\n",
       "<td>CCT,CCC,CCA,CCG</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Glutamine</td>\n",
       "<td>Q</td>\n",
       "<td>CAA,CAG</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Arginine</td>\n",
       "<td>R</td>\n",
       "<td>CGT,CGC,CGA,CGG,AGA,AGG</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Serine</td>\n",
       "<td>S</td>\n",
       "<td>TCT,TCC,TCA,TCG,AGT,AGC</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Threonine</td>\n",
       "<td>T</td>\n",
       "<td>ACT,ACC,ACA,ACG</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Valine</td>\n",
       "<td>V</td>\n",
       "<td>GTT,GTC,GTA,GTG</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Tryptophan</td>\n",
       "<td>W</td>\n",
       "<td>TGA,TGG</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>Tyrosine</td>\n",
       "<td>Y</td>\n",
       "<td>TAT,TAC</td>\n",
       "</tr>\n",
       "<tr>\n",
       "<td>STOP</td>\n",
       "<td>*</td>\n",
       "<td>TAA,TAG</td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "Mold, Protozoan, and Coelenterate Mitochondrial, and Mycoplasma/Spiroplasma Nuclear\n",
       "======================================================\n",
       "           aa    IUPAC code                     codons\n",
       "------------------------------------------------------\n",
       "      Alanine             A            GCT,GCC,GCA,GCG\n",
       "     Cysteine             C                    TGT,TGC\n",
       "Aspartic Acid             D                    GAT,GAC\n",
       "Glutamic Acid             E                    GAA,GAG\n",
       "Phenylalanine             F                    TTT,TTC\n",
       "      Glycine             G            GGT,GGC,GGA,GGG\n",
       "    Histidine             H                    CAT,CAC\n",
       "   Isoleucine             I                ATT,ATC,ATA\n",
       "       Lysine             K                    AAA,AAG\n",
       "      Leucine             L    TTA,TTG,CTT,CTC,CTA,CTG\n",
       "   Methionine             M                        ATG\n",
       "   Asparagine             N                    AAT,AAC\n",
       "      Proline             P            CCT,CCC,CCA,CCG\n",
       "    Glutamine             Q                    CAA,CAG\n",
       "     Arginine             R    CGT,CGC,CGA,CGG,AGA,AGG\n",
       "       Serine             S    TCT,TCC,TCA,TCG,AGT,AGC\n",
       "    Threonine             T            ACT,ACC,ACA,ACG\n",
       "       Valine             V            GTT,GTC,GTA,GTG\n",
       "   Tryptophan             W                    TGA,TGG\n",
       "     Tyrosine             Y                    TAT,TAC\n",
       "         STOP             *                    TAA,TAG\n",
       "------------------------------------------------------"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from cogent3 import get_code\n",
    "\n",
    "gc = get_code(4)\n",
    "gc"
   ]
  }
 ],
 "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"
  },
  "pycharm": {
   "stem_cell": {
    "cell_type": "raw",
    "metadata": {
     "collapsed": false
    },
    "source": []
   }
  },
  "widgets": {
   "application/vnd.jupyter.widget-state+json": {
    "state": {},
    "version_major": 2,
    "version_minor": 0
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
