Skip to content

Instantly share code, notes, and snippets.

@n005
Last active October 11, 2019 18:59
Show Gist options
  • Save n005/f0994f535a52b8a3d9f285fd7c35be58 to your computer and use it in GitHub Desktop.
Save n005/f0994f535a52b8a3d9f285fd7c35be58 to your computer and use it in GitHub Desktop.
Python code for the automatic association of the genetic code and α-amino acids.
DNA = 'UUUUUCUUAUGUUGABBBUAAUAG' #Input DNA
n = 3
list = ["UUU", "UUC", "UUA", "UUG", "CUU", "CUC", "CUA", "CUG", "AUU", "AUC", "AUA", "AUG", "GUU", "GUC", "GUA", "GUG", "UCU", "UCC", "UCA", "UCG", "CCU", "CCC", "CCA", "CCG", "ACU", "ACC", "ACA", "ACG", "GCU", "GCC", "GCA", "GCG", "UAU", "UAC", "UAA", "UAG", "CAU", "CAC", "CAA", "CAG", "AAU", "AAC"," AAA", "AAG", "GAU", "GAC", "GAA", "GAG", "UGU", "UGC", "UGA", "UGG", "CGU", "CGC", "CGA", "CGG", "AGU", "AGC", "AGA", "AGG", "GGU", "GGC", "GGA", "GGG"]
list2 = ["Phe", "Phe", "Leu", "Leu", "Leu", "Leu", "Leu", "Leu", "lle", "lle", "lle", "Met", "Val", "Val", "Val", "Val", "Ser", "Ser", "Ser", "Ser", "Pro", "Pro", "Pro", "Pro", "Thr", "Thr", "Thr", "Thr", "Ala", "Ala", "Ala", "Ala", "Tyr", "Tyr", "Cod", "Stp", "His", "His", "Gln", "Gln", "Asn", "Asn", "Lys", "Lys", "Asp", "Asp", "Glu", "Glu", "Cys", "Cys", "Co/", "Try", "Arg", "Arg", "Arg", "Arg", "Ser", "Ser", "Arg", "Arg", "Cly", "Cly", "Cly", "Cly"]
list3 = []
e = 1
split_value0 = [DNA[i:i+n] for i in range(0, len(DNA), n)]
for a in range(len(split_value0)):
for b in range(len(list)):
if split_value0[a] == list[b]:
list3.append(list2[b])
e = 0
if e == 1:
list3.append("000")
e = 1
print (split_value0) #Split by 3 DNA
print (list3) #Output α-amino acid
@n005
Copy link
Author

n005 commented Oct 11, 2019

Code python pour l'association automatique du code génétique et des acides α-aminé. SVT 1re.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment