btllib: btllib::SeedNtHash Class Reference

btllib

Loading...
Searching...
No Matches
Public Member Functions | List of all members
btllib::SeedNtHash Class Reference

`#include <nthash_seed.hpp>`

## Public Member Functions
| SeedNtHash (const char *seq, size_t seq_len, const std::vector< std::string > &seeds, hashing_internals::NUM_HASHES_TYPE num_hashes_per_seed, hashing_internals::K_TYPE k, size_t pos=0)
| SeedNtHash (const std::string &seq, const std::vector< std::string > &seeds, hashing_internals::NUM_HASHES_TYPE num_hashes_per_seed, hashing_internals::K_TYPE k, size_t pos=0)
| SeedNtHash (const char *seq, size_t seq_len, const std::vector< std::vector< unsigned > > &seeds, hashing_internals::NUM_HASHES_TYPE num_hashes_per_seed, hashing_internals::K_TYPE k, size_t pos=0)
| SeedNtHash (const std::string &seq, const std::vector< std::vector< unsigned > > &seeds, hashing_internals::NUM_HASHES_TYPE num_hashes_per_seed, hashing_internals::K_TYPE k, size_t pos=0)
| SeedNtHash (const SeedNtHash &obj)
| SeedNtHash (SeedNtHash &&)=default
bool | roll ()
bool | roll_back ()
bool | peek ()
bool | peek_back ()
bool | peek (char char_in)
bool | peek_back (char char_in)
const uint64_t * | hashes () const
size_t | get_pos () const
unsigned | get_hash_num () const
hashing_internals::NUM_HASHES_TYPE | get_hash_num_per_seed () const
hashing_internals::K_TYPE | get_k () const
uint64_t * | get_forward_hash () const
uint64_t * | get_reverse_hash () const

## Detailed Description

Spaced seed hashing.

## Constructor & Destructor Documentation

## ◆ SeedNtHash() [1/4]

btllib::SeedNtHash::SeedNtHash | ( | const char * | seq,
|  | size_t | seq_len,
|  | const std::vector< std::string > & | seeds,
|  | hashing_internals::NUM_HASHES_TYPE | num_hashes_per_seed,
|  | hashing_internals::K_TYPE | k,
|  | size_t | pos = 0 )
| inline

Construct an ntHash object for spaced seeds.

Parameters

  seq | C-string of the sequence to be hashed
  seq_len | Length of the sequence
  seeds | Vector of spaced seed patterns as strings (1s as cares, 0s as don't cares, must be of size `k`)
  num_hashes_per_seed | Number of hashes to generate per seed
  k | K-mer size
  pos | Position in seq to start hashing from

## ◆ SeedNtHash() [2/4]

btllib::SeedNtHash::SeedNtHash | ( | const std::string & | seq,
|  | const std::vector< std::string > & | seeds,
|  | hashing_internals::NUM_HASHES_TYPE | num_hashes_per_seed,
|  | hashing_internals::K_TYPE | k,
|  | size_t | pos = 0 )
| inline

Construct an ntHash object for spaced seeds.

Parameters

  seq | String of the sequence to be hashed
  seeds | Vector of spaced seed patterns as strings (1s as cares, 0s as don't cares, must be of size `k`)
  num_hashes_per_seed | Number of hashes to generate per seed
  k | K-mer size
  pos | Position in seq to start hashing from

## ◆ SeedNtHash() [3/4]

btllib::SeedNtHash::SeedNtHash | ( | const char * | seq,
|  | size_t | seq_len,
|  | const std::vector< std::vector< unsigned > > & | seeds,
|  | hashing_internals::NUM_HASHES_TYPE | num_hashes_per_seed,
|  | hashing_internals::K_TYPE | k,
|  | size_t | pos = 0 )
| inline

Construct an ntHash object for spaced seeds.

Parameters

  seq | C-string of the sequence to be hashed
  seq_len | Length of the sequence
  seeds | Vector of parsed spaced seed patterns (vectors of don't care positions)
  num_hashes_per_seed | Number of hashes to generate per seed
  k | K-mer size
  pos | Position in seq to start hashing from

## ◆ SeedNtHash() [4/4]

btllib::SeedNtHash::SeedNtHash | ( | const std::string & | seq,
|  | const std::vector< std::vector< unsigned > > & | seeds,
|  | hashing_internals::NUM_HASHES_TYPE | num_hashes_per_seed,
|  | hashing_internals::K_TYPE | k,
|  | size_t | pos = 0 )
| inline

Construct an ntHash object for spaced seeds.

Parameters

  seq | String of the sequence to be hashed
  seeds | Vector of parsed spaced seed patterns (vectors of don't care positions)
  num_hashes_per_seed | Number of hashes to generate per seed
  k | K-mer size
  pos | Position in seq to start hashing from

## Member Function Documentation

## ◆ get_forward_hash()

uint64_t * btllib::SeedNtHash::get_forward_hash | ( |  | ) | const
| inline

Get the hash values of the forward strand.

Returns
  Array of forward hash value arrays for each seed

## ◆ get_hash_num()

unsigned btllib::SeedNtHash::get_hash_num | ( |  | ) | const
| inline

Get the length of the hash array.

Returns
  Number of seeds times `get_hash_num_per_seed()`

## ◆ get_hash_num_per_seed()

hashing_internals::NUM_HASHES_TYPE btllib::SeedNtHash::get_hash_num_per_seed | ( |  | ) | const
| inline

Get the number of hashes generated per seed.

Returns
  Number of hashes per seed

## ◆ get_k()

hashing_internals::K_TYPE btllib::SeedNtHash::get_k | ( |  | ) | const
| inline

Get the length of the k-mers.

Returns
  `k`

## ◆ get_pos()

size_t btllib::SeedNtHash::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.

Returns
  Position of the most recently hashed k-mer's first base-pair

## ◆ get_reverse_hash()

uint64_t * btllib::SeedNtHash::get_reverse_hash | ( |  | ) | const
| inline

Get the hash values of the reverse strand.

Returns
  Array of reverse-complement hash value arrays for each seed

## ◆ hashes()

const uint64_t * btllib::SeedNtHash::hashes | ( |  | ) | const
| inline

Get the array of current hash values (length = `get_hash_num()`)

Returns
  Pointer to the hash array

## ◆ peek() [1/2]

bool btllib::SeedNtHash::peek | ( |  | ) |
| inline

Peeks the hash values as if roll() was called. Refer to NtHash::peek() for more information.

Returns
  `true` on success and `false` otherwise.

## ◆ peek() [2/2]

bool btllib::SeedNtHash::peek | ( | char | char_in | ) |
| inline

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

Returns
  `true` on success and `false` otherwise.

## ◆ peek_back() [1/2]

bool btllib::SeedNtHash::peek_back | ( |  | ) |
| inline

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

Returns
  `true` on success and `false` otherwise.

## ◆ peek_back() [2/2]

bool btllib::SeedNtHash::peek_back | ( | char | char_in | ) |
| inline

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

Returns
  `true` on success and `false` otherwise.

## ◆ roll()

bool btllib::SeedNtHash::roll | ( |  | ) |
| inline

Calculate the next hash value. Refer to NtHash::roll() for more information.

Returns
  `true` on success and `false` otherwise.

## ◆ roll_back()

bool btllib::SeedNtHash::roll_back | ( |  | ) |
| inline

Like the roll() function, but advance backwards.

Returns
  `true` on success and `false` otherwise.

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

- include/btllib/nthash_seed.hpp