-
Notifications
You must be signed in to change notification settings - Fork 0
/
4. Codon_to_aminoacid.py
20 lines (19 loc) · 1016 Bytes
/
4. Codon_to_aminoacid.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Author: Vasanth Desai
# Date: 04/06/2020
# Title: Translates a codon into an aminoacid using an internal dictionary with the standard genetic code
def translate_codon (cod):
tc = {"GCT":"A", "GCC":"A", "GCA":"A", "GCG":"A",
"TGT":"C", "TGC":"C",
"GAT":"D", "GAC":"D",
"GAA":"E", "GAG":"E",
"TTT":"F", "TTC":"F",
"GGT":"G", "GGC":"G", "GGA":"G",
"GGG":"G", "CAT":"H", "CAC":"H",
"ATA":"I", "ATT":"I", "ATC":"I", "AAA":"K", "AAG":"K", "TTA":"L", "TTG":"L", "CTT":"L", "CTC":"L", "CTA":"L", "CTG":"L",
"ATG":"M", "AAT":"N", "AAC":"N", "CCT":"P", "CCC":"P", "CCA":"P", "CCG":"P", "CAA":"Q", "CAG":"Q",
"CGT":"R", "CGC":"R", "CGA":"R", "CGG":"R", "AGA":"R", "AGG":"R",
"TCT":"S", "TCC":"S", "TCA":"S", "TCG":"S", "AGT":"S", "AGC":"S",
"ACT":"T", "ACC":"T", "ACA":"T", "ACG":"T", "GTT":"V", "GTC":"V", "GTA":"V", "GTG":"V", "TGG":"W", "TAT":"Y", "TAC":"Y",
"TAA":"_", "TAG":"_", "TGA":"_"}
if cod in tc: return tc[cod]
else: return None