forked from justinbois/bootcamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bioinfo_dicts.py
47 lines (41 loc) · 1003 Bytes
/
bioinfo_dicts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""
Useful bioinformatics dictionaries.
"""
aa = {'A': 'Ala',
'R': 'Arg',
'N': 'Asn',
'D': 'Asp',
'C': 'Cys',
'Q': 'Gln',
'E': 'Glu',
'G': 'Gly',
'H': 'His',
'I': 'Ile',
'L': 'Leu',
'K': 'Lys',
'M': 'Met',
'F': 'Phe',
'P': 'Pro',
'S': 'Ser',
'T': 'Thr',
'W': 'Trp',
'Y': 'Tyr',
'V': 'Val'}
# The set of DNA bases
bases = ['T', 'C', 'A', 'G']
# Build list of codons
codon_list = []
for first_base in bases:
for second_base in bases:
for third_base in bases:
codon_list += [first_base + second_base + third_base]
# The amino acids that are coded for (* = STOP codon)
amino_acids = 'FFLLSSSSYY**CC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG'
# Build dictionary from tuple of 2-tuples (technically an iterator, but it works)
codons = dict(zip(codon_list, amino_acids))
del codon_list
del amino_acids
del bases
del first_base
del second_base
del third_base