Example #1
0
// Set the quality at position pos to e to reflect the given p(Error).
func (self *QSeq) SetE(pos seq.Position, e float64) {
	if pos.Ind != 0 {
		panic("packed: index out of range")
	}
	self.S[pos.Pos-self.offset] &^= ((1 << 6) - 1) << 2
	self.S[pos.Pos-self.offset] = alphabet.QPack(alphabet.Ephred(e)) << 2
}
Example #2
0
File: qseq.go Project: frogs/biogo
// Set the quality at position pos to l to reflect the given p(Error).
func (self *QSeq) SetE(pos seq.Position, e float64) {
	if pos.Ind != 0 {
		panic("protein: index out of range")
	}
	self.S[pos.Pos-self.offset].Q = alphabet.Ephred(e)
}
Example #3
0
func (self *QSeq) SetE(pos seq.Position, l float64) {
	self.S[pos.Pos-self.offset][pos.Ind].Q = alphabet.Ephred(l)
}
Example #4
0
File: phred.go Project: frogs/biogo
func (self *Phred) SetE(pos seq.Position, e float64) {
	self.S[pos.Pos-self.offset] = alphabet.Ephred(e)
}
Example #5
0
	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)))),
	}
}

// Tolerance on float comparison for QConsensify
var FloatTolerance float64 = 1e-10

// A default Consensifyer function that takes letter quality into account.
// http://staden.sourceforge.net/manual/gap4_unix_120.html
var QConsensify = func(a Aligned, pos int, fill bool) alphabet.QLetter {
	alpha := a.Alphabet()

	w := make([]float64, alpha.Len())
	for i := range w {
		w[i] = 1
	}