Skip to content

Instantly share code, notes, and snippets.

@kortschak
Created August 5, 2011 08:02
Show Gist options
  • Save kortschak/1127095 to your computer and use it in GitHub Desktop.
Save kortschak/1127095 to your computer and use it in GitHub Desktop.
type Kmer uint32
func (self *Index) GetPositionsKmer(kmer Kmer) (positions []int, err os.Error) {
if kmer > self.kMask {
return nil, bio.NewError("Kmer out of range", 0, []Kmer{kmer, self.kMask})
}
i := Kmer(0)
if kmer != 0 { // special case: An has no predecessor
i = self.finger[kmer-1]
}
j := self.finger[kmer]
if i == j {
return
}
positions = make([]int, j-i)
for l, p := range self.pos[i:j] {
positions[l] = int(p)
}
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment