Struct bio::alphabets::RankTransform
[−]
[src]
pub struct RankTransform {
pub ranks: SymbolRanks,
}Tools based on transforming the alphabet symbols to their lexicographical ranks.
Fields
ranks: SymbolRanks
Methods
impl RankTransform[src]
fn new(alphabet: &Alphabet) -> Self
Construct a new RankTransform.
fn get(&self, a: u8) -> u8
Get the rank of symbol a.
fn transform<'a, T: IntoTextIterator<'a>>(&self, text: T) -> Vec<u8>
Transform a given text.
fn qgrams<'a, T: IntoTextIterator<'a>>(&'a self, q: u32, text: T) -> QGrams<T::IntoIter>
Iterate over q-grams (substrings of length q) of given text. The q-grams are encoded
as usize by storing the symbol ranks in log2(|A|) bits (with |A| being the alphabet size).
If q is larger than usize::BITS / log2(|A|), this method fails with an assertion.
fn alphabet(&self) -> Alphabet
Restore alphabet from transform.