Struct sourmash::sketch::minhash::KmerMinHash
source · pub struct KmerMinHash { /* private fields */ }
Implementations§
source§impl KmerMinHash
impl KmerMinHash
sourcepub fn builder() -> KmerMinHashBuilder<((), (), (), (), (), (), (), ())>
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
impl KmerMinHash
pub fn new( scaled: u64, ksize: u32, hash_function: HashFunctions, seed: u64, track_abundance: bool, num: u32, ) -> KmerMinHash
pub fn num(&self) -> u32
pub fn is_protein(&self) -> bool
pub fn max_hash(&self) -> u64
pub fn scaled(&self) -> u64
pub fn clear(&mut self)
pub fn is_empty(&self) -> bool
pub fn set_hash_function(&mut self, h: HashFunctions) -> Result<(), Error>
pub fn track_abundance(&self) -> bool
pub fn enable_abundance(&mut self) -> Result<(), Error>
pub fn disable_abundance(&mut self)
pub fn md5sum(&self) -> String
pub fn add_hash(&mut self, hash: u64)
pub fn add_hash_with_abundance(&mut self, hash: u64, abundance: u64)
pub fn set_hash_with_abundance(&mut self, hash: u64, abundance: u64)
pub fn add_word(&mut self, word: &[u8])
pub fn remove_hash(&mut self, hash: u64)
pub fn remove_from(&mut self, other: &KmerMinHash) -> Result<(), Error>
pub fn remove_many<T: IntoIterator<Item = u64>>( &mut self, hashes: T, ) -> Result<(), Error>
pub fn merge(&mut self, other: &KmerMinHash) -> Result<(), Error>
pub fn add_from(&mut self, other: &KmerMinHash) -> Result<(), Error>
pub fn add_many(&mut self, hashes: &[u64]) -> Result<(), Error>
pub fn add_many_with_abund( &mut self, hashes: &[(u64, u64)], ) -> Result<(), Error>
pub fn count_common( &self, other: &KmerMinHash, downsample: bool, ) -> Result<u64, Error>
pub fn intersection( &self, other: &KmerMinHash, ) -> Result<(Vec<u64>, u64), Error>
pub fn intersection_size( &self, other: &KmerMinHash, ) -> Result<(u64, u64), Error>
pub fn jaccard(&self, other: &KmerMinHash) -> Result<f64, Error>
pub fn angular_similarity(&self, other: &KmerMinHash) -> Result<f64, Error>
pub fn similarity( &self, other: &KmerMinHash, ignore_abundance: bool, downsample: bool, ) -> Result<f64, Error>
pub fn dayhoff(&self) -> bool
pub fn hp(&self) -> bool
pub fn mins(&self) -> Vec<u64>
pub fn iter_mins(&self) -> impl Iterator<Item = &u64>
pub fn abunds(&self) -> Option<Vec<u64>>
pub fn downsample_max_hash(&self, max_hash: u64) -> Result<KmerMinHash, Error>
pub fn sum_abunds(&self) -> u64
pub fn to_vec_abunds(&self) -> Vec<(u64, u64)>
pub fn as_hll(&self) -> HyperLogLog
pub fn n_unique_kmers(&self) -> u64
pub fn downsample_scaled(&self, scaled: u64) -> Result<KmerMinHash, Error>
pub fn inflate(&mut self, abunds_from: &KmerMinHash) -> Result<(), Error>
pub fn inflated_abundances( &self, abunds_from: &KmerMinHash, ) -> Result<(Vec<u64>, u64), Error>
Trait Implementations§
source§impl Clone for KmerMinHash
impl Clone for KmerMinHash
source§impl Debug for KmerMinHash
impl Debug for KmerMinHash
source§impl Default for KmerMinHash
impl Default for KmerMinHash
source§fn default() -> KmerMinHash
fn default() -> KmerMinHash
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for KmerMinHash
impl<'de> Deserialize<'de> for KmerMinHash
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
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
impl From<&KmerMinHashBTree> for KmerMinHash
source§fn from(other: &KmerMinHashBTree) -> KmerMinHash
fn from(other: &KmerMinHashBTree) -> KmerMinHash
Converts to this type from the input type.
source§impl From<KmerMinHash> for KmerMinHashBTree
impl From<KmerMinHash> for KmerMinHashBTree
source§fn from(other: KmerMinHash) -> KmerMinHashBTree
fn from(other: KmerMinHash) -> KmerMinHashBTree
Converts to this type from the input type.
source§impl From<KmerMinHashBTree> for KmerMinHash
impl From<KmerMinHashBTree> for KmerMinHash
source§fn from(other: KmerMinHashBTree) -> KmerMinHash
fn from(other: KmerMinHashBTree) -> KmerMinHash
Converts to this type from the input type.
source§impl PartialEq for KmerMinHash
impl PartialEq for KmerMinHash
source§fn eq(&self, other: &KmerMinHash) -> bool
fn eq(&self, other: &KmerMinHash) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for KmerMinHash
impl Serialize for KmerMinHash
source§impl SigsTrait for KmerMinHash
impl SigsTrait for KmerMinHash
fn size(&self) -> usize
fn to_vec(&self) -> Vec<u64>
fn ksize(&self) -> usize
fn seed(&self) -> u64
fn hash_function(&self) -> HashFunctions
fn add_hash(&mut self, hash: u64)
fn check_compatible(&self, other: &KmerMinHash) -> Result<(), Error>
fn add_sequence(&mut self, seq: &[u8], force: bool) -> Result<(), Error>
fn add_protein(&mut self, seq: &[u8]) -> Result<(), Error>
source§impl Update<HyperLogLog> for KmerMinHash
impl Update<HyperLogLog> for KmerMinHash
Auto Trait Implementations§
impl !Freeze for KmerMinHash
impl RefUnwindSafe for KmerMinHash
impl Send for KmerMinHash
impl Sync for KmerMinHash
impl Unpin for KmerMinHash
impl UnwindSafe for KmerMinHash
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moresource§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.