Expand description
Arbitrary length sequences of bit-packed genomic data, stored on the heap.
Seq
and SeqSlice
are analogous to String
and str
. A Seq
owns its data and a SeqSlice
is a read-only window into a Seq
.
use std::collections::HashMap;
use bio_seq::prelude::*;
let reference: Seq<Dna> = dna!("ACGTTCGCATGCTACGACGATC");
let mut table: HashMap<Seq<Dna>, &SeqSlice<Dna>> = HashMap::new();
table.insert(dna!("ACGTT"), &reference[2..5]);
table.insert(dna!("ACACCCCC"), &reference[6..]);
// The query is a short window in the reference `Seq`
let query: &SeqSlice<Dna> = &reference[..5];
// The keys of the hashmap are `Seq`, but since `Seq` can be borrowed as a SeqSlice we can call `HashMap::get` on another slice.
if let Some(value) = table.get(query) {
// `SeqSlice` implements `Display`
println!("{value}");
}
Modules§
Structs§
- A sequence of bit-packed characters of arbitrary length
- A lightweight, read-only window into part of a sequence
Traits§
- A reversible sequence of things that can be complemented can be reverse complemented