Module bio_seq::kmer

source ·
Expand description

Short sequences of fixed length.

Encoded sequences of length k, fixed at compile time. Generally, the underlying storage type of Kmer should lend itself to optimisation. For example, the default Kmer instance is packed into a usize, which can be efficiently Copyed on the stack.

k * codec::BITS must fit in the storage type, e.g. usize (64 bits).

use bio_seq::prelude::*;

for (amino_kmer, amino_string) in amino!("SSLMNHKKL")
        .kmers::<3>()
        .zip(["SSL", "SLM", "LMN", "MNH", "NHK", "HKK", "KKL"])
    {
        assert_eq!(amino_kmer, amino_string);
    }

Structs§

  • By default k-mers are backed by usize, Codec::BITS * K must be <= 64
  • An iterator over the bases of a kmer
  • An iterator over all kmers of a sequence with a specified length

Traits§