generated from seqan/library-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from smehringer/doc
[DOC] Update config documentation.
- Loading branch information
Showing
6 changed files
with
322 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <hibf/config.hpp> | ||
|
||
int main() | ||
{ | ||
auto my_input = [&](size_t const /* user_bin_id */, seqan::hibf::insert_iterator it) // fixed parameters! | ||
{ | ||
it = 42; // assign something that is convertible to uint64_t | ||
}; | ||
|
||
seqan::hibf::config{.input_fn = my_input}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include <fstream> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include <hibf/test/temporary_snippet_file.hpp> | ||
|
||
seqan::hibf::test::temporary_snippet_file file1{"file1.fa", "ACGT"}; | ||
seqan::hibf::test::temporary_snippet_file file2{"file2.fa", "ACGT"}; | ||
|
||
//![main] | ||
#include <hibf/config.hpp> | ||
|
||
int main() | ||
{ | ||
std::vector<std::filesystem::path> filenames{file1.path(), file2.path()}; | ||
|
||
auto my_input = [&](size_t const user_bin_id, seqan::hibf::insert_iterator it) | ||
{ | ||
std::ifstream infile{filenames[user_bin_id]}; | ||
std::string line; | ||
std::getline(infile, line); // assume there is a sequence in the first line | ||
// Look at https://docs.seqan.de/seqan3/3-master-user/group__io__sequence__file.html for e.g. FASTA File I/O | ||
|
||
for (size_t i = 0; i < line.size() - 1; ++i) | ||
{ | ||
// compute 2-mer hashes based on the character value | ||
uint64_t hash = 4 * line[i] + line[i + 1]; | ||
// You can also look at the seqan3::kmer_hash view for hashing | ||
// https://docs.seqan.de/seqan3/3-master-user/group__search__views.html#ga6e598d6a021868f704d39df73252974f | ||
it = hash; | ||
} | ||
}; | ||
|
||
seqan::hibf::config{.input_fn = my_input}; | ||
} | ||
//![main] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include <vector> | ||
|
||
#include <hibf/config.hpp> | ||
|
||
struct dna | ||
{ | ||
int rank{0}; // 0 = A, C = 1, G = 2, T = 3 | ||
}; | ||
|
||
int main() | ||
{ | ||
// user_bins stores one dna sequence per user bin | ||
// You can look at https://docs.seqan.de/seqan3/3-master-user/group__alphabet__nucleotide.html for dna alphabets | ||
std::vector<std::vector<dna>> user_bins{{{0}, {0}, {0} /*AAA*/}, {{1}, {1}, {1} /*CCC*/}}; | ||
|
||
auto my_input = [&](size_t const user_bin_id, seqan::hibf::insert_iterator it) | ||
{ | ||
auto const & seq = user_bins[user_bin_id]; | ||
for (size_t i = 0; i < seq.size() - 1; ++i) | ||
{ | ||
// compute 2-mer hashes | ||
uint64_t hash = 4 * seq[i].rank + seq[i + 1].rank; | ||
// You can also look at the seqan3::kmer_hash view for hashing | ||
// https://docs.seqan.de/seqan3/3-master-user/group__search__views.html#ga6e598d6a021868f704d39df73252974f | ||
it = hash; | ||
} | ||
}; | ||
|
||
seqan::hibf::config{.input_fn = my_input}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <hibf/config.hpp> | ||
|
||
int main() | ||
{ | ||
auto my_input = [&](size_t const /* user_bin_id */, seqan::hibf::insert_iterator it) // fixed parameters! | ||
{ | ||
it = 42; // assign something that is convertible to uint64_t | ||
}; | ||
|
||
seqan::hibf::config{.input_fn = my_input, .number_of_user_bins = 12}; | ||
} |
7b9cf2c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
hibf – ./
hibf-seqan.vercel.app
hibf.vercel.app
hibf-git-main-seqan.vercel.app