Skip to content

Commit 1fc77f8

Browse files
committed
finish one beta
1 parent 2916371 commit 1fc77f8

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

[beta]RNA to Protein Sequence Translation

Whitespace-only changes.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
rnaDict = '''Phenylalanine (F): UUU, UUC
2+
Leucine (L): UUA, UUG, CUU, CUC, CUA, CUG
3+
Isoleucine (I): AUU, AUC, AUA
4+
Methionine (M): AUG
5+
Valine (V): GUU, GUC, GUA, GUG
6+
Serine (S): UCU, UCC, UCA, UCG, AGU, AGC
7+
Proline (P): CCU, CCC, CCA, CCG
8+
Threonine (T): ACU, ACC, ACA, ACG
9+
Alanine(A): GCU, GCC, GCA, GCG
10+
Tyrosine (Y): UAU, UAC
11+
Histidine (H): CAU, CAC
12+
Glutamine (Q): CAA, CAG
13+
Asparagine (N): AAU, AAC
14+
Lysine (K): AAA, AAG
15+
Aspartic Acid (D): GAU, GAC
16+
Glutamic Acid (E): GAA, GAG
17+
Cysteine (C): UGU, UGC
18+
Tryptophan (W): UGG
19+
Artinine (R): CGU, CGC, CGA, CGG, AGA, AGG
20+
Glycine (G): GGU, GGC, GGA, GGG
21+
Stop Codon ('Stop'): UGA, UAA, UAG'''
22+
23+
import re
24+
def protein(rna):
25+
transDict = {}
26+
for line in rnaDict.split('\n'):
27+
for section in line[line.index(':')+1:].replace(' ','').split(','):
28+
transDict[section] = re.findall(r'\(+\'?(\w+)',line)[0]
29+
codec = ''
30+
while len(rna) > 0:
31+
if transDict[rna[:3]] == 'Stop':
32+
pass
33+
else:
34+
codec += transDict[rna[:3]]
35+
rna = rna[3:]
36+
return codec
37+

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy