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: add usage docs for sig import/ingest #2785

Merged
merged 3 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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