Last active
December 15, 2019 12:01
-
-
Save Roxiun/215316cc5a155e469b0fe2c730bd7aa5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
dna_letters = "ATGC" #All possible DNA letter | |
rna_letters = "UACG" #All possible RNA Letters | |
dna = input("Please enter you DNA string: ") #Gets DNA Input | |
dna = dna.upper() #Changes DNA to uppercase if not already | |
print(f"Your DNA sequence is: {dna}") #Prints the DNA Sequence | |
rna = "" #Creates a blank variable | |
for letter in dna: #For ever letter in DNA it loops | |
for i in range(4): #Loops 4 times since there is only 4 possible letters | |
if letter == dna_letters[i]: #If hat index is the same as one of the letters | |
rna += rna_letters[i] #Adds the RNA version of it to the variable | |
print(f"Your messenger RNA strand is: {rna}") #Prints the Final RNA sequence | |
rna_codon_3_letter = {"UUU":"Phe", "UCU":"Ser", "UAU":"Tyr", "UGU":"Cys", "UUC":"Phe", "UCC":"Ser", "UAC":"Tyr", "UGC":"Cys", "UUA":"Leu", "UCA":"Ser", "UAA":"STO", "UGA":"STO", "UUG":"Leu", "UCG":"Ser", "UAG":"STO", "UGG":"Trp", "CUU":"Leu", "CCU":"Pro", "CAU":"His", "CGU":"Arg", "CUC":"Leu", "CCC":"Pro", "CAC":"His", "CGC":"Arg", "CUA":"Leu", "CCA":"Pro", "CAA":"Gln", "CGA":"Arg", "CUG":"Leu", "CCG":"Pro", "CAG":"Gln", "CGG":"Arg", "AUU":"Ile", "ACU":"Thr", "AAU":"Asn", "AGU":"Ser", "AUC":"Ile", "ACC":"Thr", "AAC":"Asn", "AGC":"Ser", "AUA":"Ile", "ACA":"Thr", "AAA":"Lys", "AGA":"Arg", "AUG":"Met", "ACG":"Thr", "AAG":"Lys", "AGG":"Arg", "GUU":"Val", "GCU":"Ala", "GAU":"Asp", "GGU":"Gly", "GUC":"Val", "GCC":"Ala", "GAC":"Asp", "GGC":"Gly", "GUA":"Val", "GCA":"Ala", "GAA":"Glu", "GGA":"Gly", "GUG":"Val", "GCG":"Ala", "GAG":"Glu", "GGG":"Gly"} | |
amino_acid = "" | |
for i in range(0, len(rna)-(3+len(rna)%3), 3): | |
if rna_codon_3_letter[rna[i:i+3]] == "STOP" : | |
break | |
amino_acid += rna_codon_3_letter[rna[i:i+3]] | |
amino_acid += " " | |
amino_acid += rna_codon_3_letter[rna[-3:]] | |
print(f"Your amino aicd chain is: {amino_acid}") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment