Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common API for hashing functions #6

Open
edawson opened this issue Jun 12, 2019 · 0 comments
Open

Common API for hashing functions #6

edawson opened this issue Jun 12, 2019 · 0 comments

Comments

@edawson
Copy link
Owner

edawson commented Jun 12, 2019

Writing this down here so I can remember it one day, when I've submitted my thesis...

Right now we have an API for hashing kmers (calc_hash(**)) and reads (calc_hashes(**)). However, these have fixed hash functions (currently MurmerHash64). Ideally, it would be easier if we could drop in new hash functions using a common API rather than the spaghetti code / infinite-if-elif-elses the design currently uses.

I'm imagining a function that takes a string, a start position, an end position, and a std::function that wraps a given hash function with the necessary parameters. The signature might look something like:

mkmh::hash_t calc_hash(char* seq, const size_t& start, const size_t& end, std::function<mkmh::hash_t(char*, int, int, int)>& hashfunc)

where hashfunc is a wrapper around a hash function that might look like:

mkmh::hash_t murmurhash64(const char* seq, int offset, int end, int seed);

It's a little strange passing a nearly identical function to another one, but it means we could use multiple hash functions within mkmh without modifying the API (or even adding to the source code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant