Skip to content

Instantly share code, notes, and snippets.

@Roxiun
Created December 8, 2019 12:31
Show Gist options
  • Save Roxiun/f73ed176f2a3bb75b309d2882453d056 to your computer and use it in GitHub Desktop.
Save Roxiun/f73ed176f2a3bb75b309d2882453d056 to your computer and use it in GitHub Desktop.
import time
print("Loading")
time.sleep(1)
print("Loading.")
time.sleep(1)
print("Loading..")
time.sleep(1)
print("Loading...")
time.sleep(1)
print("Loading completed!")
time.sleep(1)
print("""This code will do as following:""")
time.sleep(1)
print("""1) Ask the user for a sequence of DNA code.""")
time.sleep(1)
print("""2) Determine the complementary-DNA/messenger
-RNA strand based on the DNA code entered.""")
time.sleep(1)
print("""3) Determine the corresponding chain of amino acids made.""")
a = input("Please enter your DNA sequence: ")
print("Your DNA sequence is: ", a.upper())
a = a.lower()
a = a.replace('c', 'G')
a = a.replace('a', 'U')
a = a.replace('t', 'A')
a = a.replace('g', 'C')
print("The messenger/complimentary RNA strand is: ", a)
rna = a
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"}
#RNA Dictionary with all the acid names
protein_string = ""
for i in range(0, len(rna)-(3+len(rna)%3), 3):
if rna_codon_3_letter[rna[i:i+3]] == "STOP" :
break
protein_string += rna_codon_3_letter[rna[i:i+3]]
protein_string += " "
print(f"Your amino aicd chain is: {protein_string}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment