Struct bio::data_structures::fmindex::FMDIndex [] [src]

pub struct FMDIndex<DBWT: DerefBWT + Clone, DLess: DerefLess + Clone, DOcc: DerefOcc + Clone> {
    // some fields omitted
}

The FMD-Index for linear time search of supermaximal exact matches on forward and reverse strand of DNA texts (Li, 2012).

Methods

impl<DBWT: DerefBWT + Clone, DLess: DerefLess + Clone, DOcc: DerefOcc + Clone> FMDIndex<DBWT, DLess, DOcc>
[src]

fn smems(&self, pattern: &[u8], i: usize) -> Vec<BiInterval>

Find supermaximal exact matches of given pattern that overlap position i in the pattern. Complexity O(m) with pattern of length m.

Example

use bio::alphabets::dna;
use bio::data_structures::fmindex::{FMIndex, FMDIndex};
use bio::data_structures::suffix_array::suffix_array;
use bio::data_structures::bwt::{bwt, less, Occ};

let text = b"ATTC$GAAT$";
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 fmdindex = FMDIndex::from(fm);

let pattern = b"ATT";
let intervals = fmdindex.smems(pattern, 2);

let forward_positions = intervals[0].forward().occ(&sa);

let revcomp_positions = intervals[0].revcomp().occ(&sa);

assert_eq!(forward_positions, [0]);
assert_eq!(revcomp_positions, [6]);

fn backward_ext(&self, interval: &BiInterval, a: u8) -> BiInterval

fn forward_ext(&self, interval: &BiInterval, a: u8) -> BiInterval

Trait Implementations

impl<DBWT: DerefBWT + Clone, DLess: DerefLess + Clone, DOcc: DerefOcc + Clone> FMIndexable for FMDIndex<DBWT, DLess, DOcc>
[src]

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

Provide a reference to the underlying BWT.

Perform backward search, yielding suffix array interval denoting exact occurrences of the given pattern of length m in the text. Complexity: O(m). Read more

impl<DBWT: DerefBWT + Clone, DLess: DerefLess + Clone, DOcc: DerefOcc + Clone> From<FMIndex<DBWT, DLess, DOcc>> for FMDIndex<DBWT, DLess, DOcc>
[src]

fn from(fmindex: FMIndex<DBWT, DLess, DOcc>) -> FMDIndex<DBWT, DLess, DOcc>

Construct a new instance of the FMD index (see Heng Li (2012) Bioinformatics). This expects a BWT that was created from a text over the DNA alphabet with N (alphabets::dna::n_alphabet()) consisting of the concatenation with its reverse complement, separated by the sentinel symbol $. I.e., let T be the original text and R be its reverse complement. Then, the expected text is T$R$. Further, multiple concatenated texts are allowed, e.g. T1$R1$T2$R2$T3$R3$.