Skip to content

Multiple Kmer Lookup

Adam Taranto edited this page Sep 23, 2024 · 3 revisions

This section describes how to look up multiple k-mers at once.

# create table
kct = oxli.KmerCountTable(ksize=3)

# Count some k-mers
kct.count('AAA')
kct.count('AAA')
kct.count('AAG')

# Check the hashes for our kmers
print(f" Hash of 'AAA': {kmer_table1.hash_kmer('AAA')}") # 10679328328772601858
print(f" Hash of 'AAG': {kmer_table2.hash_kmer('AAG')}") # 12774992397053849803

# Get counts for ordered list of hash keys
kct.get_hash_array([12774992397053849803, 10679328328772601858])
# [1, 2] # Output in same order as query list