Skip to content

Commit

Permalink
MRG: add usage docs for sig import/ingest (#2785)
Browse files Browse the repository at this point in the history
Fixes #1715
  • Loading branch information
ctb authored Sep 27, 2023
1 parent 8e63153 commit c2d1d15
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions doc/command-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 14 additions & 2 deletions src/sourmash/cli/sig/ingest.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
"""ingest/import a mash or other signature"""

usage="""
sourmash sig ingest --csv <input filename> [ <more inputs> ] -o <output>
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='+')
Expand All @@ -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)
4 changes: 2 additions & 2 deletions src/sourmash/sig/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"filter",
"flatten",
"downsample",
"sig_import",
"ingest",
"export",
"kmers",
"fileinfo",
Expand Down Expand Up @@ -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.
"""
Expand Down

0 comments on commit c2d1d15

Please sign in to comment.