Sha256: 91881a0e5115df3441ca2ab05ae1f04c0fd2d020f8840903631cad2f6ddbbde2
Contents?: true
Size: 771 Bytes
Versions: 122
Compression:
Stored size: 771 Bytes
Contents
package protein func FromCodon(codon string) string { switch codon { case "AUG": return "Methionine" case "UUU", "UUC": return "Phenylalanine" case "UUA", "UUG": return "Leucine" case "UCU", "UCC", "UCA", "UCG": return "Serine" case "UAU", "UAC": return "Tyrosine" case "UGU", "UGC": return "Cysteine" case "UGG": return "Tryptophan" case "UAA", "UAG", "UGA": return "STOP" } return "STOP" } func FromRNA(s string) []string { var res = "" var proteins []string for index, codon := range s { res += string(codon) if index > 0 && (index+1)%3 == 0 { tempCodon := FromCodon(res) if tempCodon == "STOP" { break } proteins = append(proteins, tempCodon) res = "" } } return proteins }
Version data entries
122 entries across 122 versions & 1 rubygems