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 plugin support for argparse usage/description/epilog #2696

Merged
merged 6 commits into from
Aug 13, 2023

Conversation

ctb
Copy link
Contributor

@ctb ctb commented Jul 31, 2023

This PR adds support for argparse usage and epilog strings, as well as formatter_class, per argparse docs.

See sourmash-bio/sourmash_plugin_template@cb5d454 for general use in plugins, and ctb/sourmash_plugin_commonhash@3fbb4d2 for an example use in commonhash.

This means that e.g. commonhash now supports pleasing output for both bad usage and -h flag -

sourmash scripts commonhash    
usage: 
   sourmash scripts commonhash [ -m 2 ] *.sig.gz -o filtered.zip
 commonhash: error: the following arguments are required: sigfiles, -o/--output

and

== This is sourmash version 4.8.3.dev0. ==
== Please cite Brown and Irber (2016), doi:10.21105/joss.00027. ==

usage: 
   sourmash scripts commonhash [ -m 2 ] *.sig.gz -o filtered.zip

filter hashes by min occurrence across sketches

Reduce 'noise' in Jaccard comparisons of sequencing data by removing
hashes that are present in only a few sketches.

'commonhash' supports the full range of sourmash sketch output formats [1].

[1] https://sourmash.readthedocs.io/en/latest/command-line.html#choosing-signature-output-formats

---

positional arguments:
  sigfiles              input signatures

options:
  -h, --help            show this help message and exit
  -q, --quiet           suppress non-error output
  -d, --debug           provide debugging output
  -k KSIZE, --ksize KSIZE
                        select this k-mer size
  -o OUTPUT, --output OUTPUT
                        save sketches to this location; e.g. output.zip or ./output/
  -m MIN_SAMPLES, --min-samples MIN_SAMPLES
                        a hash must be in this many samples to be retained

See https://github.com/ctb/sourmash_plugin_commonhash for more examples.

Need help? Have questions? Ask at http://github.com/sourmash/issues!

@codecov
Copy link

codecov bot commented Jul 31, 2023

Codecov Report

Merging #2696 (6cb3b20) into latest (02d2331) will increase coverage by 7.57%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           latest    #2696      +/-   ##
==========================================
+ Coverage   85.26%   92.83%   +7.57%     
==========================================
  Files         133      104      -29     
  Lines       15182    12401    -2781     
  Branches     2612     2614       +2     
==========================================
- Hits        12945    11513    -1432     
+ Misses       1936      587    -1349     
  Partials      301      301              
Flag Coverage Δ
hypothesis-py 25.80% <9.09%> (-0.02%) ⬇️
python 92.83% <100.00%> (+<0.01%) ⬆️
rust ?

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

Files Changed Coverage Δ
src/sourmash/plugins.py 100.00% <100.00%> (ø)

... and 29 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@luizirber luizirber merged commit f44b03e into latest Aug 13, 2023
@luizirber luizirber deleted the update/plugins_argparse_support branch August 13, 2023 23:36
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.

2 participants