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 -d/--debug to sourmash sig describe; upgrade output errors. #1782

Merged
merged 4 commits into from
Mar 25, 2022
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
4 changes: 4 additions & 0 deletions src/sourmash/cli/sig/describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ def subparser(subparsers):
'-q', '--quiet', action='store_true',
help='suppress non-error output'
)
subparser.add_argument(
'-d', '--debug', action='store_true',
help='provide debugging output'
)
subparser.add_argument(
'--csv', metavar='FILE',
help='output information to a CSV file'
Expand Down
9 changes: 6 additions & 3 deletions src/sourmash/sig/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def describe(args):
"""
provide basic info on signatures
"""
set_quiet(args.quiet)
set_quiet(args.quiet, args.debug)
moltype = sourmash_args.calculate_moltype(args)
picklist = sourmash_args.load_picklist(args)
pattern_search = sourmash_args.load_include_exclude_db_patterns(args)
Expand Down Expand Up @@ -287,7 +287,8 @@ def manifest(args):
loader = sourmash_args.load_file_as_index(args.location,
yield_all_files=args.force)
except ValueError as exc:
error(f"Cannot open '{args.location}'.")
error(f"Cannot open '{args.location}' as a sourmash signature collection.")
error("Use -d/--debug for details.")
sys.exit(-1)

rebuild = True
Expand Down Expand Up @@ -1193,6 +1194,7 @@ def kmers(args):
_SketchInfo = namedtuple('_SketchInfo', 'ksize, moltype, scaled, num, abund')


# NOTE: also aliased as 'summarize'
def fileinfo(args):
"""
provide summary information on the given path (collection, index, etc.)
Expand All @@ -1209,7 +1211,8 @@ def fileinfo(args):
idx = sourmash_args.load_file_as_index(args.path,
yield_all_files=args.force)
except ValueError:
error(f"Cannot open '{args.path}'.")
error(f"Cannot open '{args.path}' as a sourmash signature collection.")
error("Use -d/--debug for details.")
sys.exit(-1)

print_bool = lambda x: "yes" if x else "no"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cmd_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -3572,7 +3572,7 @@ def test_sig_manifest_does_not_exist(runtmp):
runtmp.run_sourmash('sig', 'manifest', 'does-not-exist',
'-o', 'out.csv')

assert "Cannot open 'does-not-exist'." in runtmp.last_result.err
assert "Cannot open 'does-not-exist' as a sourmash signature collection." in runtmp.last_result.err


def test_sig_manifest_7_allzip_1(runtmp):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cmd_signature_fileinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,4 +329,4 @@ def test_sig_fileinfo_does_not_exist(runtmp):
with pytest.raises(SourmashCommandFailed):
runtmp.run_sourmash('sig', 'fileinfo', 'does-not-exist')

assert "Cannot open 'does-not-exist'." in runtmp.last_result.err
assert "Cannot open 'does-not-exist' as a sourmash signature collection" in runtmp.last_result.err