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

[EXP] use roaring bitmaps for MinHash #3444

Draft
wants to merge 3 commits into
base: latest
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/core/src/index/revindex/disk_revindex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ impl RevIndexOps for RevIndex {
let hashes_iter = query.iter_mins().map(|hash| {
let mut v = vec![0_u8; 8];
(&mut v[..])
.write_u64::<LittleEndian>(*hash)
.write_u64::<LittleEndian>(hash)
.expect("error writing bytes");
(&cf_hashes, v)
});
Expand All @@ -306,7 +306,7 @@ impl RevIndexOps for RevIndex {
let hashes_iter = query.iter_mins().map(|hash| {
let mut v = vec![0_u8; 8];
(&mut v[..])
.write_u64::<LittleEndian>(*hash)
.write_u64::<LittleEndian>(hash)
.expect("error writing bytes");
(&cf_hashes, v)
});
Expand All @@ -332,7 +332,7 @@ impl RevIndexOps for RevIndex {
.entry(color)
.or_insert_with(|| new_vals.clone());
counter.update(new_vals);
(*k, color)
(k, color)
})
})
.collect();
Expand Down Expand Up @@ -449,7 +449,7 @@ impl RevIndexOps for RevIndex {
// Prepare counter for finding the next match by decrementing
// all hashes found in the current match in other datasets
// TODO: not used at the moment, so just skip.
query.remove_many(match_mh.iter_mins().copied())?; // is there a better way?
query.remove_many(match_mh.iter_mins())?; // is there a better way?

// TODO: Use HashesToColors here instead. If not initialized,
// build it.
Expand Down
4 changes: 2 additions & 2 deletions src/core/src/index/revindex/mem_revindex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ impl RevIndex {
// Prepare counter for finding the next match by decrementing
// all hashes found in the current match in other datasets
for hash in match_mh.iter_mins() {
if let Some(color) = self.hash_to_color.get(hash) {
if let Some(color) = self.hash_to_color.get(&hash) {
counter.subtract(self.colors.indices(color).cloned());
}
}
Expand Down Expand Up @@ -292,7 +292,7 @@ impl RevIndex {
pub fn counter_for_query(&self, query: &KmerMinHash) -> SigCounter {
query
.iter_mins()
.filter_map(|hash| self.hash_to_color.get(hash))
.filter_map(|hash| self.hash_to_color.get(&hash))
.flat_map(|color| self.colors.indices(color))
.cloned()
.collect()
Expand Down
Loading
Loading