#+title: Molecular Evolution Simulator for Amino Acids #+STARTUP: content hideblocks * Rules - If the nucleotide change causes an amino acid change, mark the change as lethal, and use the previous sequence for further mutations - if the nucleotide change doesn’t modify the amino acid, simply proceed with the change in place - Students must translate the codons to amino acids themselves (possibly only the ones changed) - have students mark lethality and proceed with forward movement - print out at the end ** Text from Siobain #+begin_quote Translate your DNA sequence into amino acids. If the mutation is synonymous (despite the mutation there is no change in amino acid), then allow the mutation to survive to all subsequent rounds of mutation. If it is nonsynonymous, then the mutation was lethal, and you should mark the “lethal” box on the left. Revert to the last functional sequence (the ancestral one or one that has accumulated some synonymous mutation(s)) and use that to go to the next round of mutation. Continue to mutate for 10 rounds, though not all 10 of your sequences will survive. Then insert the pdf you get from the webpage into this word document on the next page and answer the questions about your mutated sequences. #+end_quote ** Inverse codon table :PROPERTIES: :header-args: :noweb yes :END: Found [[https://en.wikipedia.org/wiki/DNA_and_RNA_codon_tables#Inverse_DNA_codon_table][on Wikipedia]]: #+name: amino-acid-to-codon | Amino acid | Codon | |------------+-------------------------| | Ala | GCT GCC GCA GCG | | Arg | CGT CGC CGA CGG AGA AGG | | Asn | AAT AAC | | Asp | GAT GAC | | Cys | TGT TGC | | Gln | CAA CAG | | Glu | GAA GAG | | Gly | GGT GGC GGA GGG | | His | CAT CAC | | Ile | ATT ATC ATA | | Leu | CTT CTC CTA CTG TTA TTG | | Lys | AAA AAG | | Met | ATG | | Phe | TTT TTC | | Pro | CCT CCC CCA CCG | | Ser | TCT TCC TCA TCG AGT AGC | | Thr | ACT ACC ACA ACG | | Trp | TGG | | Tyr | TAT TAC | | Val | GTT GTC GTA GTG | | STOP | TAA TGA TAG | #+name: aa-table-to-form #+begin_src elisp :var raw-data=amino-acid-to-codon (mapcar (lambda (kvp) (cons (car kvp) (split-string (cadr kvp)))) raw-data) #+end_src #+RESULTS: aa-table-to-form | Ala | GCT | GCC | GCA | GCG | | | | Arg | CGT | CGC | CGA | CGG | AGA | AGG | | Asn | AAT | AAC | | | | | | Asp | GAT | GAC | | | | | | Cys | TGT | TGC | | | | | | Gln | CAA | CAG | | | | | | Glu | GAA | GAG | | | | | | Gly | GGT | GGC | GGA | GGG | | | | His | CAT | CAC | | | | | | Ile | ATT | ATC | ATA | | | | | Leu | CTT | CTC | CTA | CTG | TTA | TTG | | Lys | AAA | AAG | | | | | | Met | ATG | | | | | | | Phe | TTT | TTC | | | | | | Pro | CCT | CCC | CCA | CCG | | | | Ser | TCT | TCC | TCA | TCG | AGT | AGC | | Thr | ACT | ACC | ACA | ACG | | | | Trp | TGG | | | | | | | Tyr | TAT | TAC | | | | | | Val | GTT | GTC | GTA | GTG | | | | STOP | TAA | TGA | TAG | | | | #+name: aa-table-inverted #+begin_src elisp :var raw-data=amino-acid-to-codon (let ((codon-alist (mapcar (lambda (aa-to-codons) (cons (cdr aa-to-codons) (car aa-to-codons))) <>))) (apply 'append (mapcar (lambda (kvp) (mapcar (lambda (codon) (cons codon (cdr kvp))) (car kvp))) codon-alist))) #+end_src #+RESULTS: aa-table-inverted : ((GCT . Ala) (GCC . Ala) (GCA . Ala) (GCG . Ala) (CGT . Arg) (CGC . Arg) (CGA . Arg) (CGG . Arg) (AGA . Arg) (AGG . Arg) (AAT . Asn) (AAC . Asn) (GAT . Asp) (GAC . Asp) (TGT . Cys) (TGC . Cys) (CAA . Gln) (CAG . Gln) (GAA . Glu) (GAG . Glu) (GGT . Gly) (GGC . Gly) (GGA . Gly) (GGG . Gly) (CAT . His) (CAC . His) (ATT . Ile) (ATC . Ile) (ATA . Ile) (CTT . Leu) (CTC . Leu) (CTA . Leu) (CTG . Leu) (TTA . Leu) (TTG . Leu) (AAA . Lys) (AAG . Lys) (ATG . Met) (TTT . Phe) (TTC . Phe) (CCT . Pro) (CCC . Pro) (CCA . Pro) (CCG . Pro) (TCT . Ser) (TCC . Ser) (TCA . Ser) (TCG . Ser) (AGT . Ser) (AGC . Ser) (ACT . Thr) (ACC . Thr) (ACA . Thr) (ACG . Thr) (TGG . Trp) (TAT . Tyr) (TAC . Tyr) (GTT . Val) (GTC . Val) (GTA . Val) (GTG . Val) (TAA . STOP) (TGA . STOP) (TAG . STOP)) #+name: tbl-to-json #+begin_src elisp :var raw-data=amino-acid-to-codon (let ((json-map (mapcar (lambda (kvp) (format "'%s': '%s'," (car kvp) (cdr kvp))) <>))) (format "{\n%s\n}" (string-join json-map "\n"))) #+end_src #+RESULTS: tbl-to-json #+begin_example { 'GCT': 'Ala', 'GCC': 'Ala', 'GCA': 'Ala', 'GCG': 'Ala', 'CGT': 'Arg', 'CGC': 'Arg', 'CGA': 'Arg', 'CGG': 'Arg', 'AGA': 'Arg', 'AGG': 'Arg', 'AAT': 'Asn', 'AAC': 'Asn', 'GAT': 'Asp', 'GAC': 'Asp', 'TGT': 'Cys', 'TGC': 'Cys', 'CAA': 'Gln', 'CAG': 'Gln', 'GAA': 'Glu', 'GAG': 'Glu', 'GGT': 'Gly', 'GGC': 'Gly', 'GGA': 'Gly', 'GGG': 'Gly', 'CAT': 'His', 'CAC': 'His', 'ATT': 'Ile', 'ATC': 'Ile', 'ATA': 'Ile', 'CTT': 'Leu', 'CTC': 'Leu', 'CTA': 'Leu', 'CTG': 'Leu', 'TTA': 'Leu', 'TTG': 'Leu', 'AAA': 'Lys', 'AAG': 'Lys', 'ATG': 'Met', 'TTT': 'Phe', 'TTC': 'Phe', 'CCT': 'Pro', 'CCC': 'Pro', 'CCA': 'Pro', 'CCG': 'Pro', 'TCT': 'Ser', 'TCC': 'Ser', 'TCA': 'Ser', 'TCG': 'Ser', 'AGT': 'Ser', 'AGC': 'Ser', 'ACT': 'Thr', 'ACC': 'Thr', 'ACA': 'Thr', 'ACG': 'Thr', 'TGG': 'Trp', 'TAT': 'Tyr', 'TAC': 'Tyr', 'GTT': 'Val', 'GTC': 'Val', 'GTA': 'Val', 'GTG': 'Val', 'TAA': 'STOP', 'TGA': 'STOP', 'TAG': 'STOP', } #+end_example * work steps 1. group nucleotides by codon 2. add amino acid selection area to codon group 3. fill in the first genome’s amino acids on startup 4. Use existing infrastructure to do codon mutation, but after mutation, need a place to select/display the amino acid from the codon group. 5. Then need to verify student amino acid selection 6. Then have student mark lethality 7. Then clone either current or previous genome to next genome 8. go back to 4 * Misc ** Cartesian product fun in lisp I don’t know why I did this when I knew I was just going to have to scrape a table anyway, but it was a fun exercise, and I don’t want to throw it away. #+BEGIN_SRC elisp (let* ((builder (lambda (acc depth list) (if (= depth 0) (string-join acc) (mapcar (lambda (e) (funcall builder (cons e acc) (1- depth) list)) list)))) (codons (flatten-list (funcall builder nil 3 '("A" "C" "T" "G"))))) (string-join (mapcar (lambda (c) (format "’%s’: ," c)) codons) "\n")) #+END_SRC