Skip to content

Commit

Permalink
stop using _hash_murmur
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb committed Sep 4, 2024
1 parent 2cf8f0e commit 816a124
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 2 deletions.
145 changes: 145 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ crate-type = ["cdylib"]
pyo3 = { version="0.22.2", features = ["extension-module", "anyhow"] }
sourmash = "0.15.1"
anyhow = "1.0.86"
log = "0.4.22"
env_logger = "0.11.5"
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use pyo3::prelude::*;
// use rayon::prelude::*;

use anyhow::{anyhow, Result};
use log::debug;
use std::collections::HashMap;

// use sourmash::sketch::nodegraph::Nodegraph;
use sourmash::_hash_murmur;
use sourmash::encodings::HashFunctions;
use sourmash::signature::SeqToHashes;

Expand Down Expand Up @@ -63,7 +63,7 @@ impl KmerCountTable {
"kmer size does not match count table ksize",
))
} else {
let hashval = _hash_murmur(kmer.as_bytes(), 42);
let hashval = self.hash_kmer(kmer).unwrap();
let count = self.count_hash(hashval);
Ok(count)
}
Expand All @@ -81,6 +81,7 @@ impl KmerCountTable {
Some(count) => count,
None => &0,
};
debug!("get: hashval {}, count {}", hashval, count);
Ok(*count)
}
}
Expand Down Expand Up @@ -121,6 +122,7 @@ impl KmerCountTable {

#[pymodule]
fn oxli(m: &Bound<'_, PyModule>) -> PyResult<()> {
env_logger::init();
m.add_class::<KmerCountTable>()?;
Ok(())
}

0 comments on commit 816a124

Please sign in to comment.