template<typename Tag = KmerTagDefault>
class genesis::sequence::Kmer< Tag >
Kmer class template for representing k-mers of various sizes, currently up to k-32.
The class is templated with a Tag parameter, which allows distinguishing instances of different k-mer sizes to avoid accidentally mixing them. This also serves as a mechanism to maintain the value of k for each Tag that is being used, so that it does not have to be handed over to each function using the Kmer. The downside of this is that for a given Tag, only one value of k can be used at a time. For normal use cases, this should be fine, as k usually is a fixed value for the duration of a program. Should multiple values be needed, each needs to use their own Tag.
Definition at line 69 of file kmer.hpp.
static void reset_k |
( |
uint8_t |
k | ) |
|
|
inlinestatic |
Re-set the value of k
for all Kmers of the given Tag.
Conceptually, this is the same as set_k(), but without checking that the value has not been set already. This invalidates all Kmers of the same Tag, and hence shall only be done if no instances of a Kmer with the Tag are being in use any more. Otherwise, any computations using those will produce errors or meaningless results.
Definition at line 145 of file kmer.hpp.
static void set_k |
( |
uint8_t |
k | ) |
|
|
inlinestatic |
Set the value of k
for all Kmers of the given Tag.
This needs to be called once for a given Tag in order to initialize the value of k
for the Tag. It can also only be done once, and will throw if used again with a different k
. When needing to change k
for a given Tag later on, use reset_k() instead.
Definition at line 129 of file kmer.hpp.
const uint8_t BITS_PER_CHAR = 2 |
|
static |
Number of bits needed to store a character of input data.
We currently only offer k-mers for DNA, where we use two bits per nucleotide, using A == 0b00
, C == 0b01
, G == 0b10
, T == 0b11
Definition at line 94 of file kmer.hpp.