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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRG] Fix containment calculation for nodegraphs #1862

Merged
merged 2 commits into from Mar 5, 2022

Conversation

luizirber
Copy link
Member

You might think after all these years I would not mess how to calculate containment from a Bloom Filter. Sadly, you are mistaken. Sigh.

This also means that #1138 probably works properly now 馃檲

Ready for review and merge @sourmash-bio/devs

@ctb
Copy link
Contributor

ctb commented Mar 4, 2022

Change looks good - no tests?

@codecov
Copy link

codecov bot commented Mar 4, 2022

Codecov Report

Merging #1862 (1c363da) into latest (efebe8a) will increase coverage by 0.10%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           latest    #1862      +/-   ##
==========================================
+ Coverage   82.26%   82.36%   +0.10%     
==========================================
  Files         119      119              
  Lines       12918    12929      +11     
  Branches     1727     1727              
==========================================
+ Hits        10627    10649      +22     
+ Misses       2027     2016      -11     
  Partials      264      264              
Flag Coverage 螖
python 90.34% <酶> (酶)
rust 65.80% <100.00%> (+0.35%) 猬嗭笍

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage 螖
src/core/src/sketch/nodegraph.rs 91.17% <100.00%> (+4.05%) 猬嗭笍

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update efebe8a...1c363da. Read the comment docs.

@luizirber luizirber force-pushed the lirber/nodegraph_containment branch from dfccdd8 to 1c363da Compare March 5, 2022 02:36
Comment on lines +438 to +455
#[test]
fn containment() {
let mut ng1: Nodegraph = Nodegraph::new(&[31], 3);
let mut ng2: Nodegraph = Nodegraph::new(&[31], 3);

(0..20).for_each(|i| {
if i % 2 == 0 {
ng1.count(i);
};
ng2.count(i);
});

assert_eq!(ng1.containment(&ng2), 1.0);
assert_eq!(ng1.similarity(&ng2), 0.5);
assert_eq!(ng1.unique_kmers(), 10);
assert_eq!(ng2.unique_kmers(), 20);
}

Copy link
Member Author

Choose a reason for hiding this comment

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

there you go @ctb

Copy link
Contributor

@ctb ctb left a comment

Choose a reason for hiding this comment

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

LGTM!

@luizirber luizirber merged commit 4defa47 into latest Mar 5, 2022
@luizirber luizirber deleted the lirber/nodegraph_containment branch March 5, 2022 16:25
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

Successfully merging this pull request may close these issues.

None yet

2 participants