logo
pub trait SuffixArray {
    fn get(&self, index: usize) -> Option<usize>;
fn len(&self) -> usize;
fn is_empty(&self) -> bool; fn sample<DBWT: Borrow<BWT>, DLess: Borrow<Less>, DOcc: Borrow<Occ>>(
        &self,
        text: &[u8],
        bwt: DBWT,
        less: DLess,
        occ: DOcc,
        sampling_rate: usize
    ) -> SampledSuffixArray<DBWT, DLess, DOcc> { ... } }
Expand description

A trait exposing general functionality of suffix arrays.

Required methods

Provided methods

Sample the suffix array with the given sample rate.

Arguments
  • text - text that the suffix array is built on
  • bwt - the corresponding BWT
  • less - the corresponding less array
  • occ - the corresponding occ table
  • sampling_rate - if sampling rate is k, every k-th entry will be kept
Example
use bio::alphabets::dna;
use bio::data_structures::bwt::{bwt, less, Occ};
use bio::data_structures::suffix_array::{suffix_array, SuffixArray};

let text = b"ACGCGAT$";
let alphabet = dna::n_alphabet();
let sa = suffix_array(text);
let bwt = bwt(text, &sa);
let less = less(&bwt, &alphabet);
let occ = Occ::new(&bwt, 3, &alphabet);
let sampled = sa.sample(text, &bwt, &less, &occ, 2);

for i in 0..sa.len() {
    assert_eq!(sa.get(i), sampled.get(i));
}

Implementors