for _, l := range c { if alpha.IsValid(l) { w[alpha.IndexOf(l)]++ } } var max, maxi int for i, v := range w { if v > max { max, maxi = v, i } } return alphabet.QLetter{ L: alpha.Letter(maxi), Q: alphabet.Ephred(1 - (float64(max) / float64(len(c)))), } } // A default ConsenseFunc function that takes letter quality into account. // http://staden.sourceforge.net/manual/gap4_unix_120.html DefaultQConsensus ConsenseFunc = func(a Aligned, alpha alphabet.Alphabet, pos int, fill bool) alphabet.QLetter { w := make([]float64, alpha.Len()) for i := range w { w[i] = 1 } others := float64(alpha.Len() - 1) c := a.ColumnQL(pos, fill) for _, l := range c { if alpha.IsValid(l.L) {
// SetE sets the quality at position pos to e to reflect the given p(Error). func (s *QSeq) SetE(i int, e float64) error { s.Seq[i-s.Offset].Q = alphabet.Ephred(e) return nil }