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

adjust Python API for loading and saving signatures? #1312

Open
ctb opened this issue Feb 8, 2021 · 4 comments
Open

adjust Python API for loading and saving signatures? #1312

ctb opened this issue Feb 8, 2021 · 4 comments
Labels
revisit_me An issue that needs attention and clarification

Comments

@ctb
Copy link
Contributor

ctb commented Feb 8, 2021

Some ideas rescued from #1142 -

  • load_file_as_signatures doesn't take a string input, per [MRG] Switch use of load_signatures over to load_file_as_signatures throughout. #1304. This challenges it as a replacement for sourmash.signature.load_signatures... I wonder if we can let load_file_as_signatures take a fp, instead of a string as load_signatures does? Then we could support file objects and (via io.StringIO) string inputs.

  • do we we want to change save_signatures to require a file output, OR alternatively provide a new top-level function that requires you write to a file?

@ctb
Copy link
Contributor Author

ctb commented Apr 28, 2021

side note, save_signatures should maybe be adjusted to require kwargs, something like

def save_signatures(sigs, fp=None, *, compression=0)

@ctb
Copy link
Contributor Author

ctb commented May 8, 2021

#1493 provides flexible signature saving functionality that supports Zip files, directories, and sig files.

We might want to add something to this class that makes it a single function call to write a bunch of signatures. Right now it requires multiple calls b/c of the primary use case, but this is easy to fix.

Other changes might include using ZipStorage underneath #1441.

@ctb
Copy link
Contributor Author

ctb commented May 8, 2021

(the "single function call to write a bunch of signatures" is a good next issue!)

@ctb ctb added the revisit_me An issue that needs attention and clarification label Jun 26, 2021
@ctb
Copy link
Contributor Author

ctb commented May 4, 2022

ref #1877

ctb added a commit that referenced this issue Jun 4, 2024
…signatures (#3153)

Fix `sig overlap` and `sig subtract` to take more than just JSON
signatures.

Also, adds a function `sourmash_args.load_one_signature` that I think
should (eventually) replace the now-deprecated
`sourmash.signature.load_one_signature`. This will be the topic of a new
PR - for now, I think it's a nice quick fix!

Fixes #3136

Related issues:
* #1062 - will do another
PR to close this issue
* #1877
* #1312
* #1060

TODO:
- [x] test uncovered code
- [x] do a bit more of a search and digest of related issues to see if
there's other low hanging fruit

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
revisit_me An issue that needs attention and clarification
Projects
None yet
Development

No branches or pull requests

1 participant