SuffixArray

Trait SuffixArray 

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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>