btllib
|
#include <counting_bloom_filter.hpp>
Public Member Functions | |
KmerCountingBloomFilter () | |
KmerCountingBloomFilter (size_t bytes, unsigned hash_num, unsigned k) | |
KmerCountingBloomFilter (const std::string &path) | |
KmerCountingBloomFilter (const KmerCountingBloomFilter &)=delete | |
KmerCountingBloomFilter (KmerCountingBloomFilter &&)=delete | |
KmerCountingBloomFilter & | operator= (const KmerCountingBloomFilter &)=delete |
KmerCountingBloomFilter & | operator= (KmerCountingBloomFilter &&)=delete |
void | insert (const char *seq, size_t seq_len) |
void | insert (const std::string &seq) |
void | insert (const uint64_t *hashes, T n=1) |
void | insert (const std::vector< uint64_t > &hashes, T n=1) |
void | remove (const char *seq, size_t seq_len) |
void | remove (const std::string &seq) |
void | remove (const uint64_t *hashes) |
void | remove (const std::vector< uint64_t > &hashes) |
void | clear (const char *seq, size_t seq_len) |
void | clear (const std::string &seq) |
void | clear (const uint64_t *hashes) |
void | clear (const std::vector< uint64_t > &hashes) |
uint64_t | contains (const char *seq, size_t seq_len) const |
uint64_t | contains (const std::string &seq) const |
T | contains (const uint64_t *hashes) const |
T | contains (const std::vector< uint64_t > &hashes) const |
T | contains_insert (const char *seq, size_t seq_len) |
T | contains_insert (const std::string &seq) |
T | contains_insert (const uint64_t *hashes, T n=1) |
T | contains_insert (const std::vector< uint64_t > &hashes, T n=1) |
T | insert_contains (const char *seq, size_t seq_len) |
T | insert_contains (const std::string &seq) |
T | insert_contains (const uint64_t *hashes, T n=1) |
T | insert_contains (const std::vector< uint64_t > &hashes, T n=1) |
T | insert_thresh_contains (const char *seq, size_t seq_len, T threshold) |
T | insert_thresh_contains (const std::string &seq, const T threshold) |
T | insert_thresh_contains (const uint64_t *hashes, const T threshold) |
T | insert_thresh_contains (const std::vector< uint64_t > &hashes, const T threshold) |
T | contains_insert_thresh (const char *seq, size_t seq_len, T threshold) |
T | contains_insert_thresh (const std::string &seq, const T threshold) |
T | contains_insert_thresh (const uint64_t *hashes, const T threshold) |
T | contains_insert_thresh (const std::vector< uint64_t > &hashes, const T threshold) |
size_t | get_bytes () const |
uint64_t | get_pop_cnt (T threshold=1) const |
double | get_occupancy (T threshold=1) const |
unsigned | get_hash_num () const |
double | get_fpr (T threshold=1) const |
unsigned | get_k () const |
const std::string & | get_hash_fn () const |
CountingBloomFilter< T > & | get_counting_bloom_filter () |
void | save (const std::string &path) |
Static Public Member Functions | |
static bool | is_bloom_file (const std::string &path) |
Counting Bloom filter data structure that stores k-mers. Provides KmerCountingBloomFilter8, KmerCountingBloomFilter16, and KmerCountingBloomFilter32 classes with corresponding bit-size counters.
|
inline |
Construct a dummy k-mer Bloom filter (e.g. as a default argument).
|
inline |
Construct an empty k-mer Counting Bloom filter of given size.
bytes | Filter size in bytes. |
hash_num | Number of hash values per element. |
k | K-mer size. |
|
inlineexplicit |
Load a k-mer Counting Bloom filter from a file.
path | Filepath to load from. |
|
inline |
Set the counts of a sequence's k-mers to zero in the filter.
seq | Sequence to k-merize. |
seq_len | Length of seq. |
|
inline |
Set the counts of a sequence's k-mers to zero in the filter.
seq | Sequence to k-merize. |
|
inline |
Set the counts of a sequence's k-mers to zero in the filter.
hashes | Integer vector of the k-mer's hash values. |
|
inline |
Set the counts of a sequence's k-mers to zero in the filter.
hashes | Integer array of the k-mer's hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
|
inline |
Query the counts of k-mers of a sequence.
seq | Sequence to k-merize. |
seq_len | Length of seq. |
|
inline |
Query the counts of k-mers of a sequence.
seq | Sequence to k-merize. |
|
inline |
Get a k-mer's count.
hashes | Integer vector of k-mer's hash values. |
|
inline |
Get a k-mer's count.
hashes | Integer array of k-mer's hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
|
inline |
Get the counts of a sequence's k-mers and then increment the counts.
seq | Sequence to k-merize. |
seq_len | Length of seq. |
|
inline |
Get the counts of a sequence's k-mers and then increment the counts.
seq | Sequence to k-merize. |
|
inline |
Get the count of a k-mer and then increment the count.
hashes | Integer vector of the k-mer's hash values. |
n | Increment value |
|
inline |
Get the count of a k-mer and then increment the count.
hashes | Integer array of the k-mers's hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
n | Increment value |
|
inline |
Get the counts of a sequence's k-mer's and then increment the counts if they are not above the threshold.
seq | Sequence to k-merize. |
seq_len | Length of seq. |
threshold | The threshold. |
|
inline |
Get the counts of a sequence's k-mer's and then increment the counts if they are not above the threshold.
seq | Sequence to k-merize. |
threshold | The threshold. |
|
inline |
Get the count of a k-mer and then increment the count if it's not above the threshold.
hashes | Integer vector of the k-mer's hash values. |
threshold | The threshold. |
|
inline |
Get the count of a k-mer and then increment the count if it's not above the threshold.
hashes | Integer array of the k-mer's hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
threshold | The threshold. |
|
inline |
Get filter size in bytes.
|
inline |
Get a reference to the underlying vanilla Counting Bloom filter.
|
inline |
Get the query false positive rate for elements with count >= threshold.
threshold | The threshold. |
|
inline |
Get the name of the hash function used.
|
inline |
Get the number of hash values per element.
|
inline |
Get the k-mer size used.
|
inline |
Get the fraction of the filter occupied by >0 counters.
|
inline |
Get population count, i.e. the number of counters >0 in the filter.
|
inline |
Insert a sequence's k-mers into the filter.
seq | Sequence to k-merize. |
seq_len | Length of seq. |
|
inline |
Insert a sequence's k-mers into the filter.
seq | Sequence to k-merize. |
|
inline |
Insert a k-mer into the filter.
hashes | Integer vector of the k-mer's hash values. |
n | Increment value |
|
inline |
Insert a k-mer into the filter.
hashes | Integer array of the k-mer's hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
n | Increment value |
|
inline |
Increment the counts of a sequence's k-mers and then return the counts.
seq | Sequence to k-merize. |
seq_len | Length of seq. |
|
inline |
Increment the counts of a sequence's k-mers and then return the counts.
seq | Sequence to k-merize. |
|
inline |
Increment a k-mer's count and then return the count.
hashes | Integer vector of the k-mer's hash values. |
n | Increment value |
|
inline |
Increment a k-mer's count and then return the count.
hashes | Integer array of the k-mer's hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
n | Increment value |
|
inline |
Increment the counts of a sequence's k-mers if they are not above the threshold and then return the counts.
seq | Sequence to k-merize. |
seq_len | Length of seq. |
threshold | The threshold. |
|
inline |
Increment the counts of a sequence's k-mers if they are not above the threshold and then return the counts.
seq | Sequence to k-merize. |
threshold | The threshold. |
|
inline |
Increment a k-mer's count if it's not above the threshold and then return the count.
hashes | Integer array of the k-mer's hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
threshold | The threshold. |
|
inline |
Increment a k-mer's count if it's not above the threshold and then return the count.
hashes | Integer array of the k-mer's hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
threshold | The threshold. |
|
inlinestatic |
Check whether the file at the given path is a saved k-mer counting Bloom filter.
path | Filepath to check. |
|
inline |
Decrease the counts of a sequence's k-mers from the filter.
seq | Sequence to k-merize. |
seq_len | Length of seq. |
|
inline |
Decrease the counts of a sequence's k-mers from the filter.
seq | Sequence to k-merize. |
|
inline |
Decrease the counts of a sequence's k-mers from the filter.
hashes | Integer vector of the k-mer's hash values. |
|
inline |
Decrease the counts of a sequence's k-mers from the filter.
hashes | Integer array of the k-mer's hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
|
inline |
Save the Bloom filter to a file that can be loaded in the future.
path | Filepath to store filter at. |