From c2d1d15c4c3045786e84f25cc7862731567321f4 Mon Sep 17 00:00:00 2001 From: "C. Titus Brown" Date: Wed, 27 Sep 2023 05:50:37 -0700 Subject: [PATCH] MRG: add usage docs for `sig import/ingest` (#2785) Fixes https://github.com/sourmash-bio/sourmash/issues/1715 --- doc/command-line.md | 2 ++ src/sourmash/cli/sig/ingest.py | 16 ++++++++++++++-- src/sourmash/sig/__main__.py | 4 ++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/doc/command-line.md b/doc/command-line.md index f19d2aa5be..eda5b2ac2c 100644 --- a/doc/command-line.md +++ b/doc/command-line.md @@ -1704,6 +1704,8 @@ will import the contents of `filename.msh.json` into `imported.sig`. Note: `import` only creates one output file, with one signature in it. +Note: `ingest` is an alias for `import`. + ### `sourmash signature export` - export signatures to mash. Export signatures from sourmash format. Currently only supports diff --git a/src/sourmash/cli/sig/ingest.py b/src/sourmash/cli/sig/ingest.py index c5574aadda..9c7d9e0547 100644 --- a/src/sourmash/cli/sig/ingest.py +++ b/src/sourmash/cli/sig/ingest.py @@ -1,11 +1,23 @@ """ingest/import a mash or other signature""" +usage=""" + + sourmash sig ingest --csv [ ] -o + +Ingest num sketches from a simple CSV format, or alternatively a JSON +formatproduced by 'mash info -d'. The CSV file should contain one +line per sketch, with the first column containing 'murmur64', the +second being '42', the third and fourth being the k-mer size and the +name, and the remaining columns being the hashes. + +""" + def subparser(subparsers): # Dirty hack to simultaneously support new and previous interface # If desired, this function can be removed with a major version bump. for cmd in ('ingest', 'import'): - subparser = subparsers.add_parser(cmd) + subparser = subparsers.add_parser(cmd, usage=usage) subparser.add_argument('--csv', action='store_true', help='import in Mash CSV format') subparser.add_argument('filenames', nargs='+') @@ -21,4 +33,4 @@ def subparser(subparsers): def main(args): import sourmash - return sourmash.sig.__main__.sig_import(args) + return sourmash.sig.__main__.ingest(args) diff --git a/src/sourmash/sig/__main__.py b/src/sourmash/sig/__main__.py index 809b00ab78..b3dfa93ba7 100644 --- a/src/sourmash/sig/__main__.py +++ b/src/sourmash/sig/__main__.py @@ -15,7 +15,7 @@ "filter", "flatten", "downsample", - "sig_import", + "ingest", "export", "kmers", "fileinfo", @@ -935,7 +935,7 @@ def downsample(args): sourmash_args.report_picklist(args, picklist) -def sig_import(args): +def ingest(args): """ import a signature into sourmash format. """