2 releases
0.1.1 | Sep 27, 2023 |
---|---|
0.1.0 | Sep 27, 2023 |
#310 in Biology
31KB
620 lines
KGST
Library
A library containing the implementation of a K-Truncated Generalized Suffix Tree using Ukkonen's Algorithm, along with a CLI tool to quickly build and serialize KGST's.
Usage
CLI tool to build and serialize K-Truncated Generalized Suffix trees
Usage: gst [COMMAND]
Commands: build Build suffix tree index from reference fasta file help Print this message or the help of the given subcommand(s)
Options: -h, --help Print help -V, --version Print version
lib.rs
:
K-Truncated Generalized Suffix Tree
Implementation of the truncated suffix tree construction of which is performed in linear time
Examples
use generalized_suffix_tree::suffix_tree::KGST;
// Initalize empty tree
let mut tree: KGST<char, String> = KGST::new('$');
// insert item with corresponding item id
let item_string:Vec<char> = "MKAILVVLLYTFTTADADTLCIGYHANNSTDTVDTVLEKNVTVTHSVNLLENRHNGKLCKLRGVAPLHLGKCNIAGWILGNPECESLSTAGSWSYIVETSNPDNGTCYPGDFINYEELREQLSSVSSFEKFEIFPKTSSWPNHDTNRGVTAACPHDGAKSFYRNLLWLVKKEKENSYPMINKSYTNNKGKEVLVLWAIHHPATSADQQSLYQNANAYVFVGSSKYSKKFEPEIAARPKVRDQAGRMKYYWTLVEPGDKITFEATGNLVVPIYAFALKRNSGSGIIISDTSVHDCDTTCQTPNGAINTSLPFQNIHPVTIGECPKYVKSTKLRMATGLRNIPSIQSRGLFGAIAGFIEGGWTGMIDGWYGYHHQNEQGSGYAADLKSTQNAIDGITNKVNSVIEKMNTQFTAVGKEFNHLERRIENLNKKVDDGFLDIWTYNAELLVLLENERTLDYHDSNVKNLYEKVRSQLKNNAKEIGNGCFEFYHKCDDTCMESVKNGTYDYPKYSEEAKLNREEIDGVKLESTRIYQILAIYSTVASSLVLVVSLGAISFWMCSNGSLQCRICI".chars().collect();
let item_id:String = "World".to_string();
tree.insert(item_id.clone(), item_string.clone(),&0);
// Query if some string is a substring in the tree
let substring_match = tree.substring_match(&item_string[i..i+max_depth+1]);
// Query if some string is a suffix in the tree
let suffix_match = tree.suffix_match(&item_string[i..i+max_depth+1]);
// Clear tree
tree.clear();
Dependencies
~21–31MB
~474K SLoC