btllib
Public Member Functions | List of all members
btllib::BlindNtHash Class Reference

#include <nthash.hpp>

Public Member Functions

 BlindNtHash (const char *seq, size_t seq_len, unsigned hash_num, unsigned k, size_t pos=0)
 
 BlindNtHash (const std::string &seq, unsigned hash_num, unsigned k, size_t pos=0)
 
 BlindNtHash (const BlindNtHash &nthash)
 
 BlindNtHash (BlindNtHash &&)=default
 
bool roll (char char_in)
 
bool roll_back (char char_in)
 
bool peek (char char_in)
 
bool peek_back (char char_in)
 
void sub (const std::vector< unsigned > &positions, const std::vector< unsigned char > &new_bases)
 
const uint64_t * hashes () const
 
size_t get_pos () const
 
bool forward () const
 
unsigned get_hash_num () const
 
unsigned get_k () const
 
uint64_t get_forward_hash () const
 
uint64_t get_reverse_hash () const
 
void change_seq (const std::string &new_seq, size_t new_pos=0)
 

Detailed Description

Similar to NtHash class, but instead of rolling on a predefined sequence, BlindNtHash needs to be fed the new character on each roll. This is useful when traversing an implicit de Bruijn Graph, as we need to query all bases to know the possible extensions.

Constructor & Destructor Documentation

◆ BlindNtHash() [1/2]

btllib::BlindNtHash::BlindNtHash ( const char *  seq,
size_t  seq_len,
unsigned  hash_num,
unsigned  k,
size_t  pos = 0 
)

Constructor.

Parameters
seqC string of DNA sequence to start hashing from.
seq_lenLength of seq.
hash_numNumber of hashes to produce per k-mer.
kK-mer size.
posPosition in seq to start hashing from.

◆ BlindNtHash() [2/2]

btllib::BlindNtHash::BlindNtHash ( const std::string &  seq,
unsigned  hash_num,
unsigned  k,
size_t  pos = 0 
)

Constructor.

Parameters
seqString of DNA sequence to start hashing from.
hash_numNumber of hashes to produce per k-mer.
kK-mer size.
posPosition in seq to start hashing from.

Member Function Documentation

◆ get_pos()

size_t btllib::BlindNtHash::get_pos ( ) const
inline

Get the position of last hashed k-mer or the k-mer to be hashed if roll() has never been called on this NtHash object.

◆ peek()

bool btllib::BlindNtHash::peek ( char  char_in)

Like NtHash::peek(), but as if roll(char char_in) was called.

Returns
true on success and false otherwise.

◆ peek_back()

bool btllib::BlindNtHash::peek_back ( char  char_in)

Like peek(char char_in), but as if roll_back(char char_in) was called.

Returns
true on success and false otherwise.

◆ roll()

bool btllib::BlindNtHash::roll ( char  char_in)

Like the NtHash::roll() function, but instead of advancing in the sequence BlindNtHash object was constructed on, the provided character char_in is used as the next base. Useful if you want to query for possible paths in an implicit de Bruijn graph graph.

Returns
true on success and false otherwise.

◆ roll_back()

bool btllib::BlindNtHash::roll_back ( char  char_in)

Like the roll(char char_in) function, but advance backwards.

Returns
true on success and false otherwise.

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