From dab597273a0d8e066de4606e32dadae1e300b179 Mon Sep 17 00:00:00 2001 From: Svenja Mehringer Date: Tue, 31 Oct 2023 09:28:57 +0100 Subject: [PATCH 1/2] [DOC] Add minimal example for quickstart. --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index 765d1a63..ec4a88b8 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,33 @@ target_link_libraries ( PUBLIC seqan::hibf) A quick overview on how to use the HIBF lib: +```cpp +#include // for config, insert_iterator +#include // for hierarchical_interleaved_bloom_filter + +int main() +{ + auto insert_data_fn = [&](size_t const user_bin_id, seqan::hibf::insert_iterator it) + { + // for (auto seq : files[user_bin_id]) // read file with id == `user_bin_id`, e.g. with seqan3 I/O + // for (auto hash : seq | kmer_hashing) // hash sequences e.g. with seqan3::kmer_hash + // it = hash; // insert hash into HIBF index + }; + seqan::hibf::config config{.input_fn = insert_data_fn, .number_of_user_bins = 3u}; // adapt config to your needs! + + seqan::hibf::hierarchical_interleaved_bloom_filter hibf{config}; // constructs HIBF from config + + std::vector query_hashes{3u, 9u, 12u, 14u}; + auto agent = hibf.membership_agent(); // needed for querying/searching + + for (int64_t hit_user_bin : agent.membership_for(query_hashes, 2u/*threshold*/)) + std::cout << hit_user_bin << ' '; // print out the ids of user bin with at least 2 hits from query hashes + std::cout << '\n'; +} +``` + +### A more detailed example + ```cpp From 43161558679e0bbb35fc741afccbe8f527983ec5 Mon Sep 17 00:00:00 2001 From: Svenja Mehringer Date: Tue, 31 Oct 2023 09:36:52 +0100 Subject: [PATCH 2/2] [DOC] Add online documentation link and citing. --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ec4a88b8..cf7e9530 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,17 @@ int main() } ``` -### A more detailed example +## Where to look for more information + +* The [online API documentation](https://hibf.vercel.app/topics.html) for details on the data structures + +## Please cite + +If you are working with the HIBF, please cite: + +> Hierarchical Interleaved Bloom Filter: enabling ultrafast, approximate sequence queries; Svenja Mehringer, Enrico Seiler, Felix Droop, Mitra Darvish, René Rahn, Martin Vingron, and Knut Reinert; Genome Biol 24, 131 (2023). doi: https://doi.org/10.1186/s13059-023-02971-4 + +## A more detailed example