Struct bio::data_structures::qgram_index::QGramIndex [] [src]

pub struct QGramIndex {
    // some fields omitted
}

A classical, flexible, q-gram index implementation.

Methods

impl QGramIndex
[src]

fn new(q: u32, text: &[u8], alphabet: &Alphabet) -> Self

Create a new q-gram index. The q has to be smaller than b / log2(|A|) with |A| being the alphabet size and b the number bits with the usize data type.

fn with_max_count(q: u32, text: &[u8], alphabet: &Alphabet, max_count: usize) -> Self

Create a new q-gram index, only considering q-grams that occur at most max_count times. The q has to be smaller than b / log2(|A|) with |A| being the alphabet size and b the number bits with the usize data type.

fn q(&self) -> u32

The used q.

fn qgram_matches(&self, qgram: usize) -> &[usize]

Return text positions with matching q-gram. Complexity O(1).

fn matches(&self, pattern: &[u8], min_count: usize) -> Vec<Match>

Return matches of the given pattern. Complexity O(m + k) for pattern of length m and k being the number of matching q-grams.

fn exact_matches(&self, pattern: &[u8]) -> Vec<ExactMatch>

Return exact matches (substrings) of the given pattern. Complexity O(m + k) for pattern of length m and k being the number of matching q-grams.