Struct sourmash::sketch::minhash::KmerMinHash

source ·
pub struct KmerMinHash { /* private fields */ }

Implementations§

source§

impl KmerMinHash

source

pub fn builder() -> KmerMinHashBuilder<((), (), (), (), (), (), (), ())>

Create a builder for building KmerMinHash. On the builder, call .num(...), .ksize(...), .hash_function(...)(optional), .seed(...)(optional), .max_hash(...)(optional), .mins(...)(optional), .abunds(...)(optional), .md5sum(...)(optional) to set the values of the fields. Finally, call .build() to create the instance of KmerMinHash.

source§

impl KmerMinHash

source

pub fn new( scaled: u64, ksize: u32, hash_function: HashFunctions, seed: u64, track_abundance: bool, num: u32, ) -> KmerMinHash

source

pub fn num(&self) -> u32

source

pub fn is_protein(&self) -> bool

source

pub fn max_hash(&self) -> u64

source

pub fn scaled(&self) -> u64

source

pub fn clear(&mut self)

source

pub fn is_empty(&self) -> bool

source

pub fn set_hash_function(&mut self, h: HashFunctions) -> Result<(), Error>

source

pub fn track_abundance(&self) -> bool

source

pub fn enable_abundance(&mut self) -> Result<(), Error>

source

pub fn disable_abundance(&mut self)

source

pub fn md5sum(&self) -> String

source

pub fn add_hash(&mut self, hash: u64)

source

pub fn add_hash_with_abundance(&mut self, hash: u64, abundance: u64)

source

pub fn set_hash_with_abundance(&mut self, hash: u64, abundance: u64)

source

pub fn add_word(&mut self, word: &[u8])

source

pub fn remove_hash(&mut self, hash: u64)

source

pub fn remove_from(&mut self, other: &KmerMinHash) -> Result<(), Error>

source

pub fn remove_many<T: IntoIterator<Item = u64>>( &mut self, hashes: T, ) -> Result<(), Error>

source

pub fn merge(&mut self, other: &KmerMinHash) -> Result<(), Error>

source

pub fn add_from(&mut self, other: &KmerMinHash) -> Result<(), Error>

source

pub fn add_many(&mut self, hashes: &[u64]) -> Result<(), Error>

source

pub fn add_many_with_abund( &mut self, hashes: &[(u64, u64)], ) -> Result<(), Error>

source

pub fn count_common( &self, other: &KmerMinHash, downsample: bool, ) -> Result<u64, Error>

source

pub fn intersection( &self, other: &KmerMinHash, ) -> Result<(Vec<u64>, u64), Error>

source

pub fn intersection_size( &self, other: &KmerMinHash, ) -> Result<(u64, u64), Error>

source

pub fn jaccard(&self, other: &KmerMinHash) -> Result<f64, Error>

source

pub fn angular_similarity(&self, other: &KmerMinHash) -> Result<f64, Error>

source

pub fn similarity( &self, other: &KmerMinHash, ignore_abundance: bool, downsample: bool, ) -> Result<f64, Error>

source

pub fn dayhoff(&self) -> bool

source

pub fn hp(&self) -> bool

source

pub fn mins(&self) -> Vec<u64>

source

pub fn iter_mins(&self) -> impl Iterator<Item = &u64>

source

pub fn abunds(&self) -> Option<Vec<u64>>

source

pub fn downsample_max_hash(&self, max_hash: u64) -> Result<KmerMinHash, Error>

source

pub fn sum_abunds(&self) -> u64

source

pub fn to_vec_abunds(&self) -> Vec<(u64, u64)>

source

pub fn as_hll(&self) -> HyperLogLog

source

pub fn n_unique_kmers(&self) -> u64

source

pub fn downsample_scaled(&self, scaled: u64) -> Result<KmerMinHash, Error>

source

pub fn inflate(&mut self, abunds_from: &KmerMinHash) -> Result<(), Error>

source

pub fn inflated_abundances( &self, abunds_from: &KmerMinHash, ) -> Result<(Vec<u64>, u64), Error>

Trait Implementations§

source§

impl Clone for KmerMinHash

source§

fn clone(&self) -> Self

Returns a copy 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 Debug for KmerMinHash

source§

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

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

impl Default for KmerMinHash

source§

fn default() -> KmerMinHash

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

impl<'de> Deserialize<'de> for KmerMinHash

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<&KmerMinHashBTree> for KmerMinHash

source§

fn from(other: &KmerMinHashBTree) -> KmerMinHash

Converts to this type from the input type.
source§

impl From<KmerMinHash> for KmerMinHashBTree

source§

fn from(other: KmerMinHash) -> KmerMinHashBTree

Converts to this type from the input type.
source§

impl From<KmerMinHashBTree> for KmerMinHash

source§

fn from(other: KmerMinHashBTree) -> KmerMinHash

Converts to this type from the input type.
source§

impl PartialEq for KmerMinHash

source§

fn eq(&self, other: &KmerMinHash) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for KmerMinHash

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl SigsTrait for KmerMinHash

source§

fn size(&self) -> usize

source§

fn to_vec(&self) -> Vec<u64>

source§

fn ksize(&self) -> usize

source§

fn seed(&self) -> u64

source§

fn hash_function(&self) -> HashFunctions

source§

fn add_hash(&mut self, hash: u64)

source§

fn check_compatible(&self, other: &KmerMinHash) -> Result<(), Error>

source§

fn add_sequence(&mut self, seq: &[u8], force: bool) -> Result<(), Error>

source§

fn add_protein(&mut self, seq: &[u8]) -> Result<(), Error>

source§

impl Update<HyperLogLog> for KmerMinHash

source§

fn update(&self, other: &mut HyperLogLog) -> Result<(), Error>

source§

impl Update<Nodegraph> for KmerMinHash

source§

fn update(&self, other: &mut Nodegraph) -> Result<(), Error>

Auto Trait Implementations§

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> Az for T

source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

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

§

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

§

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

§

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.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,