Struct MinimizerBuilder

Source
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>

Source

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>

Source

pub fn iter(self, seq: &[u8]) -> MinimizerIterator<'_, T, S>

Builds an iterator over the minimizers and their positions in the given sequence.

Source

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>

Source

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.

Source

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>

Source

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>

Source

pub fn iter(self, seq: &[u8]) -> ModSamplingIterator<'_, T, S>

Builds an iterator over the mod-minimizers and their positions in the given sequence.

Source

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>

Source

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.

Source

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>

Source

pub fn seed(self, seed: u64) -> Self

Sets the seed of the default hasher.

Source§

impl<T: PrimInt + Hash, A: MinimizerAlgorithm, S: BuildHasher, const CANONICAL: bool> MinimizerBuilder<T, A, S, CANONICAL>

Source

pub fn minimizer_size(self, minimizer_size: usize) -> Self

Sets the size of the minimizers.

Source

pub const fn width(self, width: u16) -> Self

Sets the width of the window.

Source

pub fn hasher<H: BuildHasher>( self, hasher: H, ) -> MinimizerBuilder<T, A, H, CANONICAL>

Sets the hasher used to compute minimizers.

Source

pub fn encoding(self, a: u8, c: u8, g: u8, t: u8) -> Self

Sets the binary encoding of the bases.

Source

pub fn canonical(self) -> MinimizerBuilder<T, A, S, true>

Compute canonical minimizers.

Source

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>

Source§

fn clone(&self) -> MinimizerBuilder<T, A, S, CANONICAL>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + PrimInt, A: Debug + MinimizerAlgorithm, S: Debug + BuildHasher, const CANONICAL: bool> Debug for MinimizerBuilder<T, A, S, CANONICAL>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: PrimInt + Hash> Default for MinimizerBuilder<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Eq + PrimInt, A: Eq + MinimizerAlgorithm, S: Eq + BuildHasher, const CANONICAL: bool> Eq for MinimizerBuilder<T, A, S, CANONICAL>

Source§

impl<T: PrimInt, A: MinimizerAlgorithm, S: BuildHasher, const CANONICAL: bool> StructuralPartialEq for MinimizerBuilder<T, A, S, CANONICAL>

Auto Trait Implementations§

§

impl<T, A, S, const CANONICAL: bool> Freeze for MinimizerBuilder<T, A, S, CANONICAL>
where S: Freeze,

§

impl<T, A, S, const CANONICAL: bool> RefUnwindSafe for MinimizerBuilder<T, A, S, CANONICAL>

§

impl<T, A, S, const CANONICAL: bool> Send for MinimizerBuilder<T, A, S, CANONICAL>
where S: Send, T: Send, A: Send,

§

impl<T, A, S, const CANONICAL: bool> Sync for MinimizerBuilder<T, A, S, CANONICAL>
where S: Sync, T: Sync, A: Sync,

§

impl<T, A, S, const CANONICAL: bool> Unpin for MinimizerBuilder<T, A, S, CANONICAL>
where S: Unpin, T: Unpin, A: Unpin,

§

impl<T, A, S, const CANONICAL: bool> UnwindSafe for MinimizerBuilder<T, A, S, CANONICAL>
where S: UnwindSafe, T: UnwindSafe, A: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.