Trait bio::data_structures::suffix_array::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§
fn get(&self, index: usize) -> Option<usize>
fn len(&self) -> usize
fn is_empty(&self) -> bool
Provided Methods§
sourcefn 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>
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 onbwt
- the corresponding BWTless
- the corresponding less arrayocc
- the corresponding occ tablesampling_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.