pub trait SuffixArray {
    // Required methods
    fn get(&self, index: usize) -> Option<usize>;
    fn len(&self) -> usize;
    fn is_empty(&self) -> bool;

    // Provided method
    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§

source

fn get(&self, index: usize) -> Option<usize>

source

fn len(&self) -> usize

source

fn is_empty(&self) -> bool

Provided Methods§

source

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>

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));
}

Object Safety§

This trait is not object safe.

Implementors§

source§

impl SuffixArray for RawSuffixArray

source§

impl<DBWT: Borrow<BWT>, DLess: Borrow<Less>, DOcc: Borrow<Occ>> SuffixArray for SampledSuffixArray<DBWT, DLess, DOcc>