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

How to replicate sourmash hash function #2455

Open
Adamtaranto opened this issue Feb 3, 2023 · 2 comments
Open

How to replicate sourmash hash function #2455

Adamtaranto opened this issue Feb 3, 2023 · 2 comments

Comments

@Adamtaranto
Copy link

Hi Titus and co.,

I want to keep track of kmer locations in a genome so I can do some downstream visualisation of select kmers from a MinHash object. I'm currently extracting each kmer from the genome, calculating its canonical hash value and storing its observed location in an SQLite db so I can quickly lookup all locations of a kmer later.

I see that I can use the MinHash.seq_to_hashes() method to get the hash value for a particular kmer, but this feels kinda clunky.

If I use mmh3.hash64() with seed 42 as per compute-dna-mh-another-way.py to calculate the hash directly will this always return the same value for a given kmer as any MinHash object? or does MinHash make other conditional mods to the hash?

Thanks!

@ctb
Copy link
Contributor

ctb commented Feb 3, 2023

hi @Adamtaranto, great question!

The script you found is exactly the code we use internally (just, you know, faster). I would definitely apply "trust-but-verify" to my statement, but we put this code in place back in ~2016, built a bunch of tests around it, and haven't changed it since then - so 🤞 it better be the same!

@ctb
Copy link
Contributor

ctb commented Sep 26, 2024

ref #3339

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

2 participants