// SetSequence assigns a nucleotide sequence to the seq field of CodonSequence.
// It also automatically fills the codons and prot fields by splitting the
// nucleotide sequence into triplets and translating each codon into its
// corresponding amino acid using the standard genetic code respectively.
SetSequence assigns a nucleotide sequence to the seq field of CodonSequence.
It also automatically fills the codons and prot fields by splitting the
nucleotide sequence into triplets and translating each codon into its
corresponding amino acid using the standard genetic code respectively.
// SetSequence assigns a nucleotide sequence to the seq field of CodonSequence . // It also automatically fills the codons and prot fields by splitting the // nucleotide sequence into triplets and translating each codon into its // corresponding amino acid using the standard genetic code respectively .
func (s *CodonSequence) SetSequence(seq string) {
	seqRune := []rune(seq)
	if len(seqRune)%3 != 0 {
		panic(fmt.Sprintf("Length of given seq \"%s\" is not divisible by 3", seq))
	}
	s.sequence = seq
	var codons []string
	for i := 0; i < len(seqRune); i += 3 {
		codons = append(codons, string(seqRune[i:i+3]))
	}
	s.codons = codons
	s.prot = Translate(seq)
}
func ( s * CodonSequence ) SetSequence ( seq string ) { seqRune := [ ] rune ( seq ) if len ( seqRune ) % 3 != 0 { panic ( fmt . Sprintf ( " \" \" " , seq ) ) } s . sequence = seq var codons [ ] string for i := 0 ; i < len ( seqRune ) ; i += 3 { codons = append ( codons , string ( seqRune [ i : i + 3 ] ) ) } s . codons = codons s . prot = Translate ( seq ) }
SetSequence assigns a nucleotide sequence to the seq field of CodonSequence.
SetSequence assigns a nucleotide sequence to the seq field of CodonSequence .
// Converts sequence to rune slice to deal with unicode chars // Overwrite value of .sequence // Overwrites value of .codons // Overwrites the value of .prot