lt-fm-index
is library for locate and count nucleotide and amino acid sequence string.
lt-fm-index
use lookup table (LT) in count table
CAVEAT! This crate
is not stable. Functions can be changed without notification.
LT
is precalculated count table containing all kmer occurrences.With LT
, you can find the first k-mer pattern at once.
LtFmIndex
is generated from Text
LtFmIndex
have two functions for Pattern
Pattern
appears in Text
.Pattern
appears in Text
.NucleotideOnly
supports a text with only genetic nucleotide sequence (ACGT).NucleotideWithNoise
supports a text containing non-nucleotide sequence.AminoacidOnly
supports a text with only amino acid sequence.AminoacidWithNoise
supports a text containing non-amino acid sequence.NucleotideOnly
, pattern of ACGTXYZ can be matched with ACGTTTT. Because X, Y and Z are not in ACG (nucleotide except T). And lt-fm-index
generated with text of ACGTXYZ indexes the text as ACGTTTT.LtFmIndex
to count and locate pattern.```rust use ltfmindex::{FmIndex, LtFmIndexConfig};
// (1) Define configuration for lt-fm-index let config = LtFmIndexConfig::fornucleotide() .withnoise() .changekmersize(4).unwrap() .changesamplingratio(4).unwrap() .changebwtintervalto128();
// (2) Generate fm-index with text let text = b"CTCCGTACACCTGTTTCGTATCGGANNNN".tovec(); let ltfm_index = config.generate(text).unwrap(); // text is consumed
// (3) Match with pattern let pattern = b"TA".tovec(); // - count let count = ltfmindex.count(&pattern); asserteq!(count, 2); // - locate let locations = ltfmindex.locate(&pattern); assert_eq!(locations, vec![5,18]); ```
LtFmIndex
```rust use ltfmindex::{LtFmIndexConfig, LtFmIndexAll, IO};
// (1) Generate FmIndex
let config = LtFmIndexConfig::fornucleotide();
let text = b"CTCCGTACACCTGTTTCGTATCGGA".tovec();
let ltfmindex = config.generate(text).unwrap(); // text is consumed
// (2) Write fm-index to buffer (or file path) let mut buffer = Vec::new(); ltfmindex.write_to(&mut buffer).unwrap();
// (3) Read fm-index from buffer (or file path) let ltfmindexbuf = LtFmIndexAll::readfrom(&buffer[..]).unwrap();
asserteq!(ltfmindex, ltfmindexbuf); ```
https://github.com/baku4/lt-fm-index
libdivsufsort