def count(self, kmer): kh = smhash(kmer) counts = self.counts for i, p in enumerate(self.primes): try: counts[i][kh % p] += 1 except (ValueError, OverflowError): pass
def get(self, kmer): if len(kmer) != self.ksize: raise KMerException('Tried to get count \ with invalid k-mer size') kh = smhash(kmer) counts = self.counts return min(table[kh % len(table)] for table in counts)
def smhash_forward(kmer): return smhash(kmer), 0