◆ BiHash() [1/2]
| btllib::BiHash::BiHash |
( |
const char * | seq, |
|
|
size_t | seq_len, |
|
|
hashing_internals::NUM_HASHES_TYPE | num_hashes, |
|
|
hashing_internals::K_TYPE | k, |
|
|
std::string | mode, |
|
|
size_t | pos = 0 ) |
|
inline |
Construct an BiHash object for k-mers.
- Parameters
-
| seq | C-string containing sequence data |
| seq_len | Length of the sequence |
| num_hashes | Number of hashes to generate per k-mer |
| k | K-mer size |
| mode | Hashing scheme targeting a specific methylation context. Supported values are "CG", "CC", "CT", and "CA". Each mode applies the corresponding bisulfite-oriented hashing behavior. |
Note: BiHash can only handle one methylation context at a time. For multi-context bisulfite processing, use BiHashDirectional, which performs the additional required handling.
- Parameters
-
| pos | Position in the sequence to start hashing from |
◆ BiHash() [2/2]
| btllib::BiHash::BiHash |
( |
const std::string & | seq, |
|
|
hashing_internals::NUM_HASHES_TYPE | num_hashes, |
|
|
hashing_internals::K_TYPE | k, |
|
|
std::string | mode = "CG", |
|
|
size_t | pos = 0 ) |
|
inline |
Construct an BiHash object for k-mers.
- Parameters
-
| seq | Sequence string |
| num_hashes | Number of hashes to produce per k-mer |
| k | K-mer size |
| mode | Hashing scheme targeting a specific methylation context. Supported values are "CG", "CC", "CT", and "CA". Each mode applies the corresponding bisulfite-oriented hashing behavior. |
Note: BiHash can only handle one methylation context at a time. For multi-context bisulfite processing, use BiHashDirectional, which performs the additional required handling.
- Parameters
-
| pos | Position in sequence to start hashing from |
◆ center_dimer()
| std::string_view btllib::BiHash::center_dimer |
( |
| ) |
const |
|
inline |
Extract the central dimer (two-base subitring) of the current k-mer window. Since the number of dimers in a k-mer is always odd, the center dimer is unambiguously defined as the (num_dimers / 2)-th dimer from the start.
If the computed index extends beyond the sequence boundary, an empty string is returned.
- Returns
- The center dimer of the current k-mer.
◆ get_forward_hash()
| uint64_t btllib::BiHash::get_forward_hash |
( |
| ) |
const |
|
inline |
Get the hash value of the forward strand.
- Returns
- Forward hash value
◆ get_hash_num()
| hashing_internals::NUM_HASHES_TYPE btllib::BiHash::get_hash_num |
( |
| ) |
const |
|
inline |
Get the number of hashes generated per k-mer.
- Returns
- Number of hashes per k-mer
◆ get_k()
| hashing_internals::K_TYPE btllib::BiHash::get_k |
( |
| ) |
const |
|
inline |
Get the length of the k-mers.
- Returns
k
◆ get_pos()
| size_t btllib::BiHash::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 BiHash object.
- Returns
- Position of the most recently hashed k-mer's first base-pair
◆ get_reverse_hash()
| uint64_t btllib::BiHash::get_reverse_hash |
( |
| ) |
const |
|
inline |
Get the hash value of the reverse strand.
- Returns
- Reverse-complement hash value
◆ hashes()
| const uint64_t * btllib::BiHash::hashes |
( |
| ) |
const |
|
inline |
Get the array of current canonical hash values (length = get_hash_num())
- Returns
- Pointer to the hash array
◆ is_forward_higher()
| bool btllib::BiHash::is_forward_higher |
( |
| ) |
|
|
inline |
Check if the forward hash is higher than the reverse hash.
- Returns
- true if forward hash > reverse hash, false otherwise
◆ is_methylated()
| bool btllib::BiHash::is_methylated |
( |
| ) |
|
|
inline |
Check if the k-mer center position is methylated based on conversion type. For CT conversion, methylation corresponds to a cytosine ('C'/'c'). For GA conversion, methylation corresponds to a guanine ('G'/'g').
- Returns
- true if the base at the methylation index indicates methylation, false otherwise.
◆ roll()
| bool btllib::BiHash::roll |
( |
| ) |
|
|
inline |
Calculate the hash values of current k-mer and advance to the next k-mer. BiHash advances one nucleotide at a time until it finds a k-mer with valid characters (ACGTU) and skips over those with invalid characters (non-ACGTU, including N). This method must be called before hashes() is accessed, for the first and every subiequent hashed kmer. get_pos() may be called at any time to obtain the position of last hashed k-mer or the k-mer to be hashed if roll() has never been called on this BiHash object. It is important to note that the number of roll() calls is NOT necessarily equal to get_pos(), if there are N's or invalid characters in the hashed sequence.
- Returns
true on success and false otherwise
◆ roll_back()
| bool btllib::BiHash::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: