-
Notifications
You must be signed in to change notification settings - Fork 80
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] Fix containment calculation for nodegraphs #1862
Conversation
Change looks good - no tests? |
Codecov Report
@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
dfccdd8
to
1c363da
Compare
#[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); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there you go @ctb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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