package protein

const testVersion = 1

func FromRNA(inp string) []string {
	var ret []string
	for i := 0; i < len(inp); i = i + 3 {
		cdn := FromCodon(inp[i : i+3])
		if cdn == "STOP" {
			break
		}
		ret = append(ret, cdn)
	}
	return ret
}

func FromCodon(inp string) string {
	switch inp {
	case "AUG":
		return "Methionine"
	case "UUU":
		return "Phenylalanine"
	case "UUC":
		return "Phenylalanine"
	case "UUA":
		return "Leucine"
	case "UUG":
		return "Leucine"
	case "UCU":
		return "Serine"
	case "UCC":
		return "Serine"
	case "UCA":
		return "Serine"
	case "UCG":
		return "Serine"
	case "UAU":
		return "Tyrosine"
	case "UAC":
		return "Tyrosine"
	case "UGU":
		return "Cysteine"
	case "UGC":
		return "Cysteine"
	case "UGG":
		return "Tryptophan"
	}
	return "STOP"
}

/*
Codon                 | Protein
:---                  | :---
AUG                   | Methionine
UUU, UUC              | Phenylalanine
UUA, UUG              | Leucine
UCU, UCC, UCA, UCG    | Serine
UAU, UAC              | Tyrosine
UGU, UGC              | Cysteine
UGG                   | Tryptophan
UAA, UAG, UGA         | STOP
*/
