digest
Loading...
Searching...
No Matches
Public Member Functions | List of all members
digest::ModMin< P > Class Template Reference

Child class of Digester that defines a minimizer as a kmer whose hash is equal to some target value after being modded. Parameters without a description are the same as the parameters in the Digester parent class. They are simply passed up to the parent constructor. More...

#include <mod_minimizer.hpp>

Inheritance diagram for digest::ModMin< P >:
digest::Digester< P >

Public Member Functions

 ModMin (const char *seq, size_t len, unsigned k, uint32_t mod, uint32_t congruence=0, size_t start=0, MinimizedHashType minimized_h=MinimizedHashType::CANON)
 
 ModMin (const std::string &seq, unsigned k, uint32_t mod, uint32_t congruence=0, size_t start=0, MinimizedHashType minimized_h=MinimizedHashType::CANON)
 
void roll_minimizer (unsigned amount, std::vector< uint32_t > &vec) override
 adds up to amount of positions of minimizers into vec. Here a k-mer is considered a minimizer if its hash is congruent to congruence in the mod space.
 
void roll_minimizer (unsigned amount, std::vector< std::pair< uint32_t, uint32_t > > &vec) override
 adds up to amount of positions and hashes of minimizers into vec. Here a k-mer is considered a minimizer if its hash is congruent to congruence in the mod space.
 
uint32_t get_mod ()
 
uint32_t get_congruence ()
 
- Public Member Functions inherited from digest::Digester< P >
 Digester (const char *seq, size_t len, unsigned k, size_t start=0, MinimizedHashType minimized_h=MinimizedHashType::CANON)
 
 Digester (const std::string &seq, unsigned k, size_t start=0, MinimizedHashType minimized_h=MinimizedHashType::CANON)
 
bool get_is_valid_hash ()
 
unsigned get_k ()
 
size_t get_len ()
 
bool roll_one ()
 moves the internal pointer to the next valid k-mer.
Time Complexity: O(1)
 
size_t get_pos ()
 
uint64_t get_chash ()
 
uint64_t get_fhash ()
 
uint64_t get_rhash ()
 
virtual void new_seq (const char *seq, size_t len, size_t start)
 replaces the current sequence with the new one. It's like starting over with a completely new seqeunce
 
virtual void new_seq (const std::string &seq, size_t pos)
 replaces the current sequence with the new one. It's like starting over with a completely new sequence
 
void append_seq (const char *seq, size_t len)
 simulates the appending of a new sequence to the end of the old sequence. The old sequence will no longer be stored, but the rolling hashes will be able to preceed as if the sequences were appended. Can only be called when you've reached the end of the current sequence i.e. if you're current sequence is ACTGAC, and you have reached the end of this sequence, and you call append_seq with the sequence CCGGCCGG, then the minimizers you will get after calling append_seq plus the minimizers you got from going through ACTGAC, will be equivalent to the minimizers you would have gotten from rolling across ACTGACCCGGCCGG
 
void append_seq (const std::string &seq)
 simulates the appending of a new sequence to the end of the old sequence. The old sequence will no longer be stored, but the rolling hashes will be able to preceed as if the sequences were appended. Can only be called when you've reached the end of the current sequence i.e. if you're current sequence is ACTGAC, and you have reached the end of this sequence, and you call append_seq with the sequence CCGGCCGG, then the minimizers you will get after calling append_seq plus the minimizers you got from going through ACTGAC, will be equivalent to the minimizers you would have gotten from rolling across ACTGACCCGGCCGG
 
MinimizedHashType get_minimized_h ()
 
const char * get_sequence ()
 

Detailed Description

template<BadCharPolicy P>
class digest::ModMin< P >

Child class of Digester that defines a minimizer as a kmer whose hash is equal to some target value after being modded. Parameters without a description are the same as the parameters in the Digester parent class. They are simply passed up to the parent constructor.

Template Parameters
P

Constructor & Destructor Documentation

◆ ModMin() [1/2]

template<BadCharPolicy P>
digest::ModMin< P >::ModMin ( const char *  seq,
size_t  len,
unsigned  k,
uint32_t  mod,
uint32_t  congruence = 0,
size_t  start = 0,
MinimizedHashType  minimized_h = MinimizedHashType::CANON 
)
inline
Parameters
seq
len
k
modmod space to be used to calculate universal minimizers
congruencevalue we want minimizer hashes to be congruent to in the mod space
start
minimized_h
Exceptions
BadModExceptionThrown when congruence is greater or equal to mod

◆ ModMin() [2/2]

template<BadCharPolicy P>
digest::ModMin< P >::ModMin ( const std::string &  seq,
unsigned  k,
uint32_t  mod,
uint32_t  congruence = 0,
size_t  start = 0,
MinimizedHashType  minimized_h = MinimizedHashType::CANON 
)
inline
Parameters
seq
k
modmod space to be used to calculate universal minimizers
congruencevalue we want minimizer hashes to be congruent to in the mod space
start
minimized_h
Exceptions
BadModExceptionThrown when congruence is greater or equal to mod

Member Function Documentation

◆ get_congruence()

template<BadCharPolicy P>
uint32_t digest::ModMin< P >::get_congruence ( )
inline
Returns
uint32_t, the value the minimized hash must be congruent to

◆ get_mod()

template<BadCharPolicy P>
uint32_t digest::ModMin< P >::get_mod ( )
inline
Returns
uint32_t, the mod space being used

◆ roll_minimizer() [1/2]

template<BadCharPolicy P>
void digest::ModMin< P >::roll_minimizer ( unsigned  amount,
std::vector< std::pair< uint32_t, uint32_t > > &  vec 
)
inlineoverridevirtual

adds up to amount of positions and hashes of minimizers into vec. Here a k-mer is considered a minimizer if its hash is congruent to congruence in the mod space.

Parameters
amount
vec

Implements digest::Digester< P >.

◆ roll_minimizer() [2/2]

template<BadCharPolicy P>
void digest::ModMin< P >::roll_minimizer ( unsigned  amount,
std::vector< uint32_t > &  vec 
)
inlineoverridevirtual

adds up to amount of positions of minimizers into vec. Here a k-mer is considered a minimizer if its hash is congruent to congruence in the mod space.

Parameters
amount
vec

Implements digest::Digester< P >.


The documentation for this class was generated from the following file: