How do kmer counters determine which kmer is 'canonical'?
When a k-mer is identical to its reverse complement, both are canonical. Note that a canonical k-mer is a sequence, irrelevant to its position(s) in the input string. More precisely, give a string $s$, its canonical string is
$$
{\rm canonical}(s|h)=\left\{\begin{array}{ll}
s &amp; \mbox{if $h(s)&lt;h(\overline{s})$}\\
\overline{s} &amp; \mbox{otherwise}\\
\end{array}\right.
$$
where $\overline{s}$ is the Watson-Crick reverse complement of $s$ and $h$ is an arbitrary string hash function. In practice, we most often use 2-bit encoding as $h$. Order under such a hash function is equivalent to the lexicographical order.