-
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 Signature.minhash
API during sourmash sketch
#2329
Conversation
Codecov Report
@@ Coverage Diff @@
## latest #2329 +/- ##
==========================================
- Coverage 84.09% 83.97% -0.13%
==========================================
Files 129 129
Lines 14951 14967 +16
Branches 2191 2191
==========================================
- Hits 12573 12568 -5
- Misses 2083 2104 +21
Partials 295 295
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
It may not in fact be bad to use copy the Some(Sketch::MinHash(mh)) => {
Ok(SourmashKmerMinHash::from_rust(mh.clone()))
}, with Some(Sketch::LargeMinHash(mh_btree)) => {
let mh = KmerMinHash::from(mh_btree.clone());
Ok(SourmashKmerMinHash::from_rust(mh)) There's already an |
Well, that's what 388b250 does! I implemented An alternate approach would be to figure out if there's an equivalent structure to |
OK, I think that would mean one of two things - First, implementing a whole new conversion a la impl ForeignObject for SourmashKmerMinHash {
type RustObject = KmerMinHash;
} but for OR... hmm, I don't think this will work because object sizes are different, but I wonder if the key methods on |
ok, changed error message for Traceback (most recent call last):
File "rs-crash.py", line 7, in <module>
sig.minhash
File "/Users/t/dev/sourmash/src/sourmash/signature.py", line 47, in minhash
self._methodcall(lib.signature_first_mh)
File "/Users/t/dev/sourmash/src/sourmash/utils.py", line 25, in _methodcall
return rustcall(func, self._get_objptr(), *args)
File "/Users/t/dev/sourmash/src/sourmash/utils.py", line 78, in rustcall
raise exc
sourmash.exceptions.Internal: internal error: "found unsupported sketch type" which at least seems explanatory ;) |
…o fix/sig_minhash_api_sketch
@luizirber ready for your inspection when you get a chance! |
There is a bunch of this happening in the mastiff PR: I started with an Enum on the FFI, without changing too much of the Rust side yet (just moving methods around to comply with the new traits in https://github.com/sourmash-bio/sourmash/pull/2230/files#diff-acf89d8b0a76cd89eccdabe5ff0fe4233ffe9b94983d50b34d1a1290a053094a |
I was guessing that, since you referred to it elsewhere! If you think there's value in merging this in now, lmk. But I'm not wedded to it and happy to wait, or have any useful code swiped for the mastiff PR. |
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 are other approaches for fixing this, but this one works now =]
Signature.minhash
API during sourmash sketch
Signature.minhash
API during sourmash sketch
…and released in v4.6.0 (#2391) This PR fixes a bug introduced in #2329 and released in v4.6.0. It also adds tests so that this bug does not trouble us again... The easiest fix involves serializing _every_ signature into JSON format, and then deserializing it. This may add a slight performance regression that I will work to fix in a different PR, once I get v4.6.1 out. Fixes #2390.
Addresses #1167 by fixing
signature_first_mh
in the signature FFI to support bothKmerMinHash
andKmerMinHashBTree
; this way, sketches generated by the Python_signatures_for_sketch_factory
(which are BTree sketches in Rust) can be passed back toPython.
Specifically, this PR:
From<&KmerMinHashBTree>
forKmerMinHash
;KmerMinHashBTree
structs and convert them intoKmerMinHash
structs suitable for returning to Python;HyperLogLog
and raise an error back to Python reporting that it found an unsupported sketch type;Note that I don't think this does any more copying of sketches than the current codebase does.
And, on that halcyonic day when the FFI properly wraps
KmerMinHashBTree
, this code can be replaced by returning the proper Rust object without conversion.Fixes #1167.