From 24121d007ca94b7b63ca6ef661ae04e7eca2d983 Mon Sep 17 00:00:00 2001 From: "C. Titus Brown" Date: Tue, 26 Sep 2023 06:10:19 -0700 Subject: [PATCH 1/2] add usage str for 'sig ingest' --- src/sourmash/cli/sig/ingest.py | 15 +++++++++++++-- src/sourmash/sig/__main__.py | 4 ++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/sourmash/cli/sig/ingest.py b/src/sourmash/cli/sig/ingest.py index c5574aadda..f120dd78df 100644 --- a/src/sourmash/cli/sig/ingest.py +++ b/src/sourmash/cli/sig/ingest.py @@ -1,11 +1,22 @@ """ingest/import a mash or other signature""" +usage=""" + + sourmash sig ingest --csv [ ] -o + +Ingest num sketches from a mash CSV format. 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 +32,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. """ From ef82e4a0c261abfd338aabad94398c27d74353e3 Mon Sep 17 00:00:00 2001 From: "C. Titus Brown" Date: Tue, 26 Sep 2023 06:12:32 -0700 Subject: [PATCH 2/2] update --- doc/command-line.md | 2 ++ src/sourmash/cli/sig/ingest.py | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/command-line.md b/doc/command-line.md index 621c20a8a1..ae0e690ef9 100644 --- a/doc/command-line.md +++ b/doc/command-line.md @@ -1705,6 +1705,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 f120dd78df..9c7d9e0547 100644 --- a/src/sourmash/cli/sig/ingest.py +++ b/src/sourmash/cli/sig/ingest.py @@ -4,10 +4,11 @@ sourmash sig ingest --csv [ ] -o -Ingest num sketches from a mash CSV format. The CSV file should contain one +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. +second being '42', the third and fourth being the k-mer size and the +name, and the remaining columns being the hashes. """