Skip to content

Commit

Permalink
Merge pull request #1355 from dib-lab/fix/1353
Browse files Browse the repository at this point in the history
Fix #1353
  • Loading branch information
standage authored Feb 14, 2017
2 parents 4f1f0cc + 9b4b038 commit 6dd8430
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/kmer_hash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ HashIntoType _hash_murmur(const std::string& kmer,
h = out[0];

std::string rev = khmer::_revcomp(kmer);
if (rev == kmer) {
// self complement kmer, can't use bitwise XOR
r = out[0];
return h;
}

MurmurHash3_x64_128((void *)rev.c_str(), rev.size(), seed, &out);
r = out[0];

Expand Down
3 changes: 3 additions & 0 deletions tests/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ def test_hash_murmur3():
assert khmer.hash_murmur3('TTTT') == 526240128537019279
assert khmer.hash_murmur3('CCCC') == 14391997331386449225
assert khmer.hash_murmur3('GGGG') == 14391997331386449225
assert khmer.hash_murmur3('TATATATATATATATATATA') != 0
assert khmer.hash_murmur3('TTTTGCAAAA') != 0
assert khmer.hash_murmur3('GAAAATTTTC') != 0


def test_hash_no_rc_murmur3():
Expand Down

0 comments on commit 6dd8430

Please sign in to comment.