logo
Expand description

A classical, flexible, q-gram index implementation.

Example

use bio::alphabets;
use bio::data_structures::qgram_index;

let text = b"ACGGCTGAGATGAT";
let alphabet = alphabets::dna::alphabet();
let q = 3;
let qgram_index = qgram_index::QGramIndex::new(q, text, &alphabet);

let pattern = b"GCTG";
let matches = qgram_index.matches(pattern, 1);
assert_eq!(
    matches,
    [qgram_index::Match {
        pattern: qgram_index::Interval { start: 0, stop: 4 },
        text: qgram_index::Interval { start: 3, stop: 7 },
        count: 2
    }]
);

Structs

An exact match between the pattern and the text.

An interval, consisting of start and stop position (the latter exclusive).

A match between the pattern and the text.

A classical, flexible, q-gram index implementation.