// UngappedPositionSlice returns a slice that counts only over characters
// that does not match the gap character in the sequence.
// If a character matches the gap character, -1 is inserted instead of the
// ungapped count.
UngappedPositionSlice returns a slice that counts only over characters
that does not match the gap character in the sequence.
If a character matches the gap character, -1 is inserted instead of the
ungapped count.
// UngappedPositionSlice returns a slice that counts only over characters // that does not match the gap character in the sequence . // If a character matches the gap character - 1 is inserted instead of the // ungapped count .
func (s *CodonSequence) UngappedPositionSlice(gapChar string) (arr []int) {
	if len([]rune(gapChar))%3 != 0 {
		panic(fmt.Sprintf("Length of given gapChar \"%s\" is not equal to 3", gapChar))
	}
	cnt := 0
	for _, codon := range s.codons {
		if codon != gapChar {
			arr = append(arr, cnt)
			cnt++
		} else {
			arr = append(arr, -1)
		}
	}
	return
}
func ( s * CodonSequence ) UngappedPositionSlice ( gapChar string ) ( arr [ ] int ) { if len ( [ ] rune ( gapChar ) ) % 3 != 0 { panic ( fmt . Sprintf ( " \" \" " , gapChar ) ) } cnt := 0 for _ , codon := range s . codons { if codon != gapChar { arr = append ( arr , cnt ) cnt ++ } else { arr = append ( arr , - 1 ) } } return }
UngappedPositionSlice returns a slice that counts only over characters
that does not match the gap character in the sequence.
UngappedPositionSlice returns a slice that counts only over characters that does not match the gap character in the sequence .
// Counts length of the rune slice instead of byte length of the string // Range over the slice of codons // If the codon does not match the gapChar string, then it is not a gap // Adds the current ungapped count to the array. // If it is a gap, adds -1 to the array instead