Example #1
0
File: multi.go Project: frogs/biogo
func (self *Multi) At(pos seq.Position) alphabet.QLetter {
	var count int
	for _, s := range self.S {
		count = s.Count()
		if pos.Ind < count {
			return s.At(pos)
		}
		pos.Ind -= count
	}

	panic("index out of range")
}
Example #2
0
File: multi.go Project: frogs/biogo
func (self *Multi) Set(pos seq.Position, l alphabet.QLetter) {
	var count int
	for _, s := range self.S {
		count = s.Count()
		if pos.Ind < count {
			s.Set(pos, l)
			return
		}
		pos.Ind -= count
	}

	panic("index out of range")
}
Example #3
0
File: multi.go Project: frogs/biogo
func (self *Multi) SetE(pos seq.Position, q float64) {
	var count int
	for _, s := range self.S {
		if a, ok := s.(seq.Counter); ok {
			count = a.Count()
		} else {
			count = 1
		}
		if pos.Ind < count {
			if qs, ok := s.(seq.Quality); ok {
				qs.SetE(pos, q)
				return
			}
		}
		pos.Ind -= count
	}

	panic("index out of range")
}
Example #4
0
File: multi.go Project: frogs/biogo
func (self *Multi) EAt(pos seq.Position) float64 {
	var count int
	for _, s := range self.S {
		if a, ok := s.(seq.Counter); ok {
			count = a.Count()
		} else {
			count = 1
		}
		if pos.Ind < count {
			if qs, ok := s.(seq.Quality); ok {
				return qs.EAt(pos)
			} else {
				return protein.DefaultQphred.ProbE()
			}
		}
		pos.Ind -= count
	}

	panic("index out of range")
}