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

MRG: update to code for forthcoming sourmash release #467

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 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
5 changes: 2 additions & 3 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ crate-type = ["cdylib"]
pyo3 = { version = "0.22.3", features = ["extension-module", "anyhow"] }
rayon = "1.10.0"
serde = { version = "1.0.210", features = ["derive"] }
sourmash = { version = "0.15.2", features = ["branchwater"] }
#sourmash = { version = "0.15.2", features = ["branchwater"] }
sourmash = { git = "https://github.com/sourmash-bio/sourmash.git", branch = "refactor_rs_downsample", features = ["branchwater"] }
serde_json = "1.0.128"
niffler = "2.4.0"
log = "0.4.22"
Expand Down
1 change: 1 addition & 0 deletions src/manysearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ fn downsample_and_inflate_abundances(
// avoid downsampling if we can
if against_scaled != query_scaled {
let against_ds = against
.clone()
.downsample_scaled(query.scaled())
.expect("cannot downsample sketch");
(abunds, sum_weighted) = query.inflated_abundances(&against_ds)?;
Expand Down
4 changes: 2 additions & 2 deletions src/python/tests/test_fastmultigather.py
Original file line number Diff line number Diff line change
Expand Up @@ -959,15 +959,15 @@ def test_indexed_full_output(runtmp):
# check a few columns
average_ani = set(df['average_containment_ani'])
avg_ani = set([round(x, 4) for x in average_ani])
assert avg_ani == {0.8502, 0.8584, 0.8602}
assert avg_ani == {0.9221, 0.9306, 0.9316} # @CTB check against py gather

f_unique_weighted = set(df['f_unique_weighted'])
f_unique_weighted = set([round(x, 4) for x in f_unique_weighted])
assert f_unique_weighted == {0.0063, 0.002, 0.0062}

unique_intersect_bp = set(df['unique_intersect_bp'])
unique_intersect_bp = set([round(x,4) for x in unique_intersect_bp])
assert unique_intersect_bp == {44000, 18000, 22000}
assert unique_intersect_bp == {4400000, 1800000, 2200000}


def test_nonindexed_full_vs_sourmash_gather(runtmp):
Expand Down
5 changes: 4 additions & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,10 @@ pub fn load_sketches_above_threshold(
if let Ok(against_sig) = against_collection.sig_from_record(against_record) {
if let Some(against_mh) = against_sig.minhash() {
// downsample against_mh, but keep original md5sum
let against_mh_ds = against_mh.downsample_scaled(query.scaled()).unwrap();
let against_mh_ds = against_mh
.clone()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would an .into_minhash() in core that consumes the signature help here? would avoid the need for .clone(), which can be substantial for big sketches

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make a PR against sourmash-bio/sourmash#3342

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! here's what I did; eliminated two (!!) clones,

9b448c8

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(comments obv welcome ;))

.downsample_scaled(query.scaled())
.unwrap();
if let Ok(overlap) = against_mh_ds.count_common(query, false) {
if overlap >= threshold_hashes {
let result = PrefetchResult {
Expand Down
Loading