[][src]Module bio::data_structures::fmindex

FM-Index and FMD-Index for finding suffix array intervals matching a given pattern in linear time.

Examples

Generate

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

Enclose in struct

FMIndex was designed to not forcibly own the BWT and auxiliary data structures. It can take a reference (&), owned structs or any of the more complex pointer types.

use bio::data_structures::bwt::{BWT, Less, bwt, less, Occ};
use bio::data_structures::fmindex::{FMIndex, FMIndexable};
use bio::data_structures::suffix_array::suffix_array;
use bio::alphabets::dna;
use bio::utils::TextSlice;

pub struct Example {
    fmindex: FMIndex<BWT, Less, Occ>
}

impl Example {
    pub fn new(text: TextSlice) -> Self {
        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);
        Example { fmindex: fm }
    }
}

Structs

BiInterval

A bi-interval on suffix array of the forward and reverse strand of a DNA text.

FMDIndex

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

FMIndex

The Fast Index in Minute space (FM-Index, Ferragina and Manzini, 2000) for finding suffix array intervals matching a given pattern.

Interval

A suffix array interval.

Traits

FMIndexable