Trait bio::data_structures::fmindex::FMIndexable
[−]
[src]
pub trait FMIndexable { fn occ(&self, r: usize, a: u8) -> usize; fn less(&self, a: u8) -> usize; fn bwt(&self) -> &BWT; fn backward_search<'b, P: Iterator<Item=&'b u8> + DoubleEndedIterator>(&self, pattern: P) -> Interval { ... } }
Required Methods
fn occ(&self, r: usize, a: u8) -> usize
Get occurrence count of symbol a in BWT[..r+1].
fn less(&self, a: u8) -> usize
Also known as
fn bwt(&self) -> &BWT
Provided Methods
fn backward_search<'b, P: Iterator<Item=&'b u8> + DoubleEndedIterator>(&self, pattern: P) -> Interval
Perform backward search, yielding suffix array interval denoting exact occurrences of the given pattern of length m in the text. Complexity: O(m).
Arguments
pattern
- the pattern to search
Example
use bio::data_structures::bwt::{bwt, less, Occ}; use bio::data_structures::fmindex::{FMIndex, FMIndexable}; use bio::data_structures::suffix_array::suffix_array; use bio::alphabets::dna; let text = b"GCCTTAACATTATTACGCCTA$"; 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 fm = FMIndex::new(&bwt, &less, &occ); let pattern = b"TTA"; let sai = fm.backward_search(pattern.iter()); let positions = sai.occ(&sa); assert_eq!(positions, [3, 12, 9]);