pub struct MinimizerBuilder<T: PrimInt = u64, A: MinimizerAlgorithm = Minimizer, S: BuildHasher = DefaultHashBuilder, const CANONICAL: bool = false> { /* private fields */ }
Expand description
A builder for iterators over minimizers.
§Examples
use minimizer_iter::MinimizerBuilder;
// Build an iterator over minimizers
// of size 3 with a window of size 4
// for the sequence "TGATTGCACAATC"
let min_iter = MinimizerBuilder::<u64>::new()
.minimizer_size(3)
.width(4)
.iter(b"TGATTGCACAATC");
for (minimizer, position) in min_iter {
// ...
}
Implementations§
Source§impl<T: PrimInt + Hash> MinimizerBuilder<T>
impl<T: PrimInt + Hash> MinimizerBuilder<T>
Sourcepub fn new() -> Self
pub fn new() -> Self
Sets up the MinimizerBuilder
with default values:
- minimizer_size = 21
- width = 11 (31 - 21 + 1)
- hasher =
DefaultHashBuilder
- encoding: A =
00
, C =01
, G =10
, T =11
Source§impl<T: PrimInt + Hash, S: BuildHasher> MinimizerBuilder<T, Minimizer, S, false>
impl<T: PrimInt + Hash, S: BuildHasher> MinimizerBuilder<T, Minimizer, S, false>
Sourcepub fn iter(self, seq: &[u8]) -> MinimizerIterator<'_, T, S> ⓘ
pub fn iter(self, seq: &[u8]) -> MinimizerIterator<'_, T, S> ⓘ
Builds an iterator over the minimizers and their positions in the given sequence.
Sourcepub fn iter_pos(self, seq: &[u8]) -> MinimizerPosIterator<'_, T, S> ⓘ
pub fn iter_pos(self, seq: &[u8]) -> MinimizerPosIterator<'_, T, S> ⓘ
Builds an iterator over the positions of the minimizers in the given sequence.
Source§impl<T: PrimInt + Hash, S: BuildHasher> MinimizerBuilder<T, Minimizer, S, true>
impl<T: PrimInt + Hash, S: BuildHasher> MinimizerBuilder<T, Minimizer, S, true>
Sourcepub fn iter(self, seq: &[u8]) -> CanonicalMinimizerIterator<'_, T, S> ⓘ
pub fn iter(self, seq: &[u8]) -> CanonicalMinimizerIterator<'_, T, S> ⓘ
Builds an iterator over the canonical minimizers and their positions in the given sequence with a boolean indicating a reverse complement. It requires an odd width to break ties between multiple minimizers.
Sourcepub fn iter_pos(self, seq: &[u8]) -> CanonicalMinimizerPosIterator<'_, T, S> ⓘ
pub fn iter_pos(self, seq: &[u8]) -> CanonicalMinimizerPosIterator<'_, T, S> ⓘ
Builds an iterator over the positions of the canonical minimizers in the given sequence with a boolean indicating a reverse complement. It requires an odd width to break ties between multiple minimizers.
Source§impl<T: PrimInt + Hash> MinimizerBuilder<T, ModMinimizer>
impl<T: PrimInt + Hash> MinimizerBuilder<T, ModMinimizer>
Sourcepub fn new_mod() -> Self
pub fn new_mod() -> Self
Sets up the MinimizerBuilder
for mod-minimizers with default values:
- minimizer_size = 21
- width = 11 (31 - 21 + 1)
- hasher =
DefaultHashBuilder
- encoding: A =
00
, C =01
, G =10
, T =11
Source§impl<T: PrimInt + Hash, S: BuildHasher> MinimizerBuilder<T, ModMinimizer, S, false>
impl<T: PrimInt + Hash, S: BuildHasher> MinimizerBuilder<T, ModMinimizer, S, false>
Sourcepub fn iter(self, seq: &[u8]) -> ModSamplingIterator<'_, T, S> ⓘ
pub fn iter(self, seq: &[u8]) -> ModSamplingIterator<'_, T, S> ⓘ
Builds an iterator over the mod-minimizers and their positions in the given sequence.
Sourcepub fn iter_pos(self, seq: &[u8]) -> ModSamplingPosIterator<'_, T, S> ⓘ
pub fn iter_pos(self, seq: &[u8]) -> ModSamplingPosIterator<'_, T, S> ⓘ
Builds an iterator over the positions of the mod-minimizers in the given sequence.
Source§impl<T: PrimInt + Hash, S: BuildHasher> MinimizerBuilder<T, ModMinimizer, S, true>
impl<T: PrimInt + Hash, S: BuildHasher> MinimizerBuilder<T, ModMinimizer, S, true>
Sourcepub fn iter(self, seq: &[u8]) -> CanonicalModSamplingIterator<'_, T, S> ⓘ
pub fn iter(self, seq: &[u8]) -> CanonicalModSamplingIterator<'_, T, S> ⓘ
Builds an iterator over the canonical mod-minimizers and their positions in the given sequence with a boolean indicating a reverse complement. It requires an odd width to break ties between multiple minimizers.
Sourcepub fn iter_pos(self, seq: &[u8]) -> CanonicalModSamplingPosIterator<'_, T, S> ⓘ
pub fn iter_pos(self, seq: &[u8]) -> CanonicalModSamplingPosIterator<'_, T, S> ⓘ
Builds an iterator over the positions of the canonical mod-minimizers in the given sequence with a boolean indicating a reverse complement. It requires an odd width to break ties between multiple minimizers.
Source§impl<T: PrimInt + Hash, A: MinimizerAlgorithm> MinimizerBuilder<T, A, DefaultHashBuilder>
impl<T: PrimInt + Hash, A: MinimizerAlgorithm> MinimizerBuilder<T, A, DefaultHashBuilder>
Source§impl<T: PrimInt + Hash, A: MinimizerAlgorithm, S: BuildHasher, const CANONICAL: bool> MinimizerBuilder<T, A, S, CANONICAL>
impl<T: PrimInt + Hash, A: MinimizerAlgorithm, S: BuildHasher, const CANONICAL: bool> MinimizerBuilder<T, A, S, CANONICAL>
Sourcepub fn minimizer_size(self, minimizer_size: usize) -> Self
pub fn minimizer_size(self, minimizer_size: usize) -> Self
Sets the size of the minimizers.
Sourcepub fn hasher<H: BuildHasher>(
self,
hasher: H,
) -> MinimizerBuilder<T, A, H, CANONICAL>
pub fn hasher<H: BuildHasher>( self, hasher: H, ) -> MinimizerBuilder<T, A, H, CANONICAL>
Sets the hasher used to compute minimizers.
Sourcepub fn encoding(self, a: u8, c: u8, g: u8, t: u8) -> Self
pub fn encoding(self, a: u8, c: u8, g: u8, t: u8) -> Self
Sets the binary encoding of the bases.
Sourcepub fn canonical(self) -> MinimizerBuilder<T, A, S, true>
pub fn canonical(self) -> MinimizerBuilder<T, A, S, true>
Compute canonical minimizers.
Sourcepub fn non_canonical(self) -> MinimizerBuilder<T, A, S, false>
pub fn non_canonical(self) -> MinimizerBuilder<T, A, S, false>
Compute non-canonical minimizers.
Trait Implementations§
Source§impl<T: Clone + PrimInt, A: Clone + MinimizerAlgorithm, S: Clone + BuildHasher, const CANONICAL: bool> Clone for MinimizerBuilder<T, A, S, CANONICAL>
impl<T: Clone + PrimInt, A: Clone + MinimizerAlgorithm, S: Clone + BuildHasher, const CANONICAL: bool> Clone for MinimizerBuilder<T, A, S, CANONICAL>
Source§fn clone(&self) -> MinimizerBuilder<T, A, S, CANONICAL>
fn clone(&self) -> MinimizerBuilder<T, A, S, CANONICAL>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<T: Debug + PrimInt, A: Debug + MinimizerAlgorithm, S: Debug + BuildHasher, const CANONICAL: bool> Debug for MinimizerBuilder<T, A, S, CANONICAL>
impl<T: Debug + PrimInt, A: Debug + MinimizerAlgorithm, S: Debug + BuildHasher, const CANONICAL: bool> Debug for MinimizerBuilder<T, A, S, CANONICAL>
Source§impl<T: PartialEq + PrimInt, A: PartialEq + MinimizerAlgorithm, S: PartialEq + BuildHasher, const CANONICAL: bool> PartialEq for MinimizerBuilder<T, A, S, CANONICAL>
impl<T: PartialEq + PrimInt, A: PartialEq + MinimizerAlgorithm, S: PartialEq + BuildHasher, const CANONICAL: bool> PartialEq for MinimizerBuilder<T, A, S, CANONICAL>
Source§fn eq(&self, other: &MinimizerBuilder<T, A, S, CANONICAL>) -> bool
fn eq(&self, other: &MinimizerBuilder<T, A, S, CANONICAL>) -> bool
self
and other
values to be equal, and is used by ==
.