#include <bloom_filter.hpp>
Bloom filter data structure stores k-mers.
btllib::KmerBloomFilter::KmerBloomFilter |
( |
| ) |
|
|
inline |
Construct a dummy Kmer Bloom filter (e.g. as a default argument).
btllib::KmerBloomFilter::KmerBloomFilter |
( |
size_t |
bytes, |
|
|
unsigned |
hash_num, |
|
|
unsigned |
k |
|
) |
| |
Construct an empty Kmer Bloom filter of given size.
- Parameters
-
bytes | Filter size in bytes. |
hash_num | Number of hash values per element. |
k | K-mer size. |
btllib::KmerBloomFilter::KmerBloomFilter |
( |
const std::string & |
path | ) |
|
|
explicit |
Load a Kmer Bloom filter from a file.
- Parameters
-
path | Filepath to load from. |
unsigned btllib::KmerBloomFilter::contains |
( |
const char * |
seq, |
|
|
size_t |
seq_len |
|
) |
| const |
Query the presence of k-mers of a sequence.
- Parameters
-
seq | Sequence to k-merize. |
seq_len | Length of seq. |
- Returns
- The number of seq's k-mers found in the filter.
unsigned btllib::KmerBloomFilter::contains |
( |
const std::string & |
seq | ) |
const |
|
inline |
Query the presence of k-mers of a sequence.
- Parameters
-
- Returns
- The number of seq's k-mers found in the filter.
bool btllib::KmerBloomFilter::contains |
( |
const uint64_t * |
hashes | ) |
const |
|
inline |
Check for the presence of an element's hash values.
- Parameters
-
hashes | Integer array of hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
bool btllib::KmerBloomFilter::contains |
( |
const std::vector< uint64_t > & |
hashes | ) |
const |
|
inline |
Check for the presence of an element's hash values.
- Parameters
-
hashes | Integer vector of hash values. |
unsigned btllib::KmerBloomFilter::contains_insert |
( |
const char * |
seq, |
|
|
size_t |
seq_len |
|
) |
| |
Query the presence of k-mers of a sequence and insert if missing.
- Parameters
-
seq | Sequence to k-merize. |
seq_len | Length of seq. |
- Returns
- The number of seq's k-mers found in the filter before insertion.
unsigned btllib::KmerBloomFilter::contains_insert |
( |
const std::string & |
seq | ) |
|
|
inline |
Query the presence of k-mers of a sequence and insert if missing.
- Parameters
-
- Returns
- The number of seq's k-mers found in the filter before insertion.
bool btllib::KmerBloomFilter::contains_insert |
( |
const uint64_t * |
hashes | ) |
|
|
inline |
Check for the presence of an element's hash values and insert if missing.
- Parameters
-
hashes | Integer array of hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
- Returns
- True if present before insertion, false otherwise.
bool btllib::KmerBloomFilter::contains_insert |
( |
const std::vector< uint64_t > & |
hashes | ) |
|
|
inline |
Check for the presence of an element's hash values and insert if missing.
- Parameters
-
hashes | Integer vector of hash values. |
- Returns
- True if present before insertion, false otherwise.
BloomFilter& btllib::KmerBloomFilter::get_bloom_filter |
( |
| ) |
|
|
inline |
Get a reference to the underlying vanilla Bloom filter.
size_t btllib::KmerBloomFilter::get_bytes |
( |
| ) |
const |
|
inline |
Get filter size in bytes.
double btllib::KmerBloomFilter::get_fpr |
( |
| ) |
const |
|
inline |
Get the query false positive rate.
const std::string& btllib::KmerBloomFilter::get_hash_fn |
( |
| ) |
const |
|
inline |
Get the name of the hash function used.
unsigned btllib::KmerBloomFilter::get_hash_num |
( |
| ) |
const |
|
inline |
Get the number of hash values per element.
unsigned btllib::KmerBloomFilter::get_k |
( |
| ) |
const |
|
inline |
double btllib::KmerBloomFilter::get_occupancy |
( |
| ) |
const |
|
inline |
Get the fraction of the filter occupied by 1 bits.
uint64_t btllib::KmerBloomFilter::get_pop_cnt |
( |
| ) |
const |
|
inline |
Get population count, i.e. the number of 1 bits in the filter.
void btllib::KmerBloomFilter::insert |
( |
const char * |
seq, |
|
|
size_t |
seq_len |
|
) |
| |
Insert a sequence's k-mers into the filter.
- Parameters
-
seq | Sequence to k-merize. |
seq_len | Length of seq. |
void btllib::KmerBloomFilter::insert |
( |
const std::string & |
seq | ) |
|
|
inline |
Insert a sequence's k-mers into the filter.
- Parameters
-
void btllib::KmerBloomFilter::insert |
( |
const uint64_t * |
hashes | ) |
|
|
inline |
Insert an element's hash values.
- Parameters
-
hashes | Integer array of hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
void btllib::KmerBloomFilter::insert |
( |
const std::vector< uint64_t > & |
hashes | ) |
|
|
inline |
Insert an element's hash values.
- Parameters
-
hashes | Integer vector of hash values. |
static bool btllib::KmerBloomFilter::is_bloom_file |
( |
const std::string & |
path | ) |
|
|
inlinestatic |
Check whether the file at the given path is a saved Kmer Bloom filter.
- Parameters
-
void btllib::KmerBloomFilter::save |
( |
const std::string & |
path | ) |
|
Save the Bloom filter to a file that can be loaded in the future.
- Parameters
-
path | Filepath to store filter at. |
The documentation for this class was generated from the following file: