{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Available genetic codes" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
Specify a genetic code using either 'Name' or Code ID (as an integer or string)
Code IDName
1Standard Nuclear
2Vertebrate Mitochondrial
3Yeast Mitochondrial
4Mold, Protozoan, and Coelenterate Mitochondrial, and Mycoplasma/Spiroplasma Nuclear
5Invertebrate Mitochondrial
6Ciliate, Dasycladacean and Hexamita Nuclear
9Echinoderm and Flatworm Mitochondrial
10Euplotid Nuclear
11Bacterial Nuclear and Plant Plastid
12Alternative Yeast Nuclear
13Ascidian Mitochondrial
14Alternative Flatworm Mitochondrial
15Blepharisma Nuclear
16Chlorophycean Mitochondrial
20Trematode Mitochondrial
22Scenedesmus obliquus Mitochondrial
23Thraustochytrium Mitochondrial
\n", "

\n", "17 rows x 2 columns

" ], "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": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
0
TombBatTGTGGCACAAGTACTCATGCC
FlyingFox..........A.G........
DogFaced..........A..........
FreeTaile.........GA..........
LittleBro.........GA..........
\n", "

5 x 21 dna alignment

\n", "" ], "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": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
0
TombBatCGTSTHASSVQHENSSLLLT
FlyingFox...NA....L....-...Y.
DogFaced...N...N.L........Y.
FreeTaile...D.....L..........
LittleBro...D.....L..........
\n", "

5 x 20 protein alignment

\n", "" ], "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": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
Mold, Protozoan, and Coelenterate Mitochondrial, and Mycoplasma/Spiroplasma Nuclear
aaIUPAC codecodons
AlanineAGCT,GCC,GCA,GCG
CysteineCTGT,TGC
Aspartic AcidDGAT,GAC
Glutamic AcidEGAA,GAG
PhenylalanineFTTT,TTC
GlycineGGGT,GGC,GGA,GGG
HistidineHCAT,CAC
IsoleucineIATT,ATC,ATA
LysineKAAA,AAG
LeucineLTTA,TTG,CTT,CTC,CTA,CTG
MethionineMATG
AsparagineNAAT,AAC
ProlinePCCT,CCC,CCA,CCG
GlutamineQCAA,CAG
ArginineRCGT,CGC,CGA,CGG,AGA,AGG
SerineSTCT,TCC,TCA,TCG,AGT,AGC
ThreonineTACT,ACC,ACA,ACG
ValineVGTT,GTC,GTA,GTG
TryptophanWTGA,TGG
TyrosineYTAT,TAC
STOP*TAA,TAG
\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 }