Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function translate(str)
- r = ""
- if str == "UUU" then
- r = "Phenylalanine"
- elseif str == "UUC" then
- r = "Phenylalanine"
- elseif str == "UUA" then
- r = "Leucine"
- elseif str == "UUG" then
- r = "Leucine"
- elseif str == "CUU" then
- r = "Leucine"
- elseif str == "CUC" then
- r = "Leucine"
- elseif str == "CUA" then
- r = "Leucine"
- elseif str == "CUG" then
- r = "Leucine"
- elseif str == "AUU" or str == "AUC" or str == "AUA" then
- r = "Isoleucine"
- elseif str == "AUG" then
- r = "Start or Methionine"
- elseif str == "GUU" or str == "GUC" or str == "GUA" or str == "GUG" then
- r = "Valine"
- elseif str == "UCU" or str == "UCC" or str == "UCA" or str == "UCG" then
- r = "Serine"
- elseif str == "CCU" or str == "CCC" or str == "CCA" or str == "CCG" then
- r = "Proline"
- elseif str == "ACU" or str == "ACC" or str == "ACA" or str == "ACG" then
- r = "Threonine"
- elseif str == "GCU" or str == "GCC" or str == "GCA" or str == "GCG" then
- r = "Alanine"
- elseif str == "UAU" or str == "UAC" then
- r = "Tyrosine"
- elseif str == "UAA" or str == "UAG" then
- r = "Stop"
- elseif str == "CAU" or str == "CAC" then
- r = "Histidine"
- elseif str == "CAA" or str == "CAG" then
- r = "Glutamine"
- elseif str == "AAU" or str == "AAC" then
- r = "Asparagine"
- elseif str == "AAA" or str == "AAG" then
- r = "Lysine"
- elseif str == "GAU" or str == "GAC" then
- r = "Aspartic Acid"
- elseif str == "GAA" or str == "GAG" then
- r = "Glutamic Acid"
- elseif str == "UGU" or str == "UGC" then
- r = "Cysteine"
- elseif str == "UGA" then
- r = "Stop"
- elseif str == "UGG" then
- r = "Tryptophan"
- elseif str == "CGU" or str == "CGC" or str == "CGA" or str == "CGG" then
- r = "Arginine"
- elseif str == "AGU" or str == "ACC" then
- r = "Serine"
- elseif str == "AGA" or str == "AGG" then
- r = "Arginine"
- elseif str == "GGU" or str == "GGC" or str == "GGA" or str == "GGG" then
- r = "Glycine"
- end
- return r
- end
- function intrans(word)
- if #word ~= 3 then
- return nil
- end
- local function trans(let)
- local kek = ""
- let = let:lower()
- if let == "a" then
- kek = "U"
- elseif let == "t" then
- kek = "A"
- elseif let == "c" then
- kek = "G"
- elseif let == "g" then
- kek = "C"
- end
- return kek
- end
- a = trans(string.sub(word,1,1))
- b = trans(string.sub(word,2,2))
- c = trans(string.sub(word,3,3))
- combine = a..b..c
- return combine
- end
- function begin(seq)
- local mrna = ""
- local protein = ""
- g = string.sub(seq,#seq,#seq)
- if g ~= " " then
- seq = seq.." "
- end
- for i=1,#seq do
- if string.sub(seq,i,i) == " " then
- local a = string.sub(seq,i-3,i-3)
- local b = string.sub(seq,i-2,i-2)
- local c = string.sub(seq,i-1,i-1)
- local abc = a..b..c
- local abcc = intrans(abc)
- local abca = translate(abcc)
- if i ~= 4 then
- protein = protein..", "..abca
- mrna = mrna.." "..abcc
- else
- protein = protein..abca
- mrna = mrna..abcc
- end
- end
- end
- return {mrna,protein}
- end
- function prin(tab)
- mrna = tab[1]
- protein = tab[2]
- print("mRNA : "..mrna.."\nProtein : "..protein)
- end
- prin(begin("TTT TTC TTA TTG CTC CTA CTG CTT ATT ATC ATA ATG GTT GTC GTA GTG TCT TCC TCA TCG CCT CCC CCA CCG ACT ACC ACA ACG ACT GCC GCA GCG TAT TAC TAA TAG CAT CAC CAA CAG AAT AAC AAA AAG GAT GAC GAA GAG TGT TGC TGA TGG CGT CGC CGA CGGAGT ACC AGA AGG GGT GGC GGA GGG"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement