From 0bf6584dbf9bdb0397e80bd5308d8d2bad1418a3 Mon Sep 17 00:00:00 2001 From: "C. Titus Brown" Date: Wed, 2 Feb 2022 06:34:13 -0800 Subject: [PATCH] add checks in tests --- src/sourmash/commands.py | 5 ++++- tests/test_sourmash.py | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/sourmash/commands.py b/src/sourmash/commands.py index d2f95b26eb..9112869719 100644 --- a/src/sourmash/commands.py +++ b/src/sourmash/commands.py @@ -791,7 +791,10 @@ def gather(args): print_results(f'(truncated gather because --num-results={args.num_results})') p_covered = (1 - weighted_missed) * 100 - print_results(f'the recovered matches hit {p_covered:.1f}% of the query') + if is_abundance: + print_results(f'the recovered matches hit {p_covered:.1f}% of the abundance-weighted query') + else: + print_results(f'the recovered matches hit {p_covered:.1f}% of the query (unweighted)') print_results('') if gather_iter.scaled != query.minhash.scaled: print_results(f'WARNING: final scaled was {gather_iter.scaled}, vs query scaled of {query.minhash.scaled}') diff --git a/tests/test_sourmash.py b/tests/test_sourmash.py index 26ceb590da..737aa556ec 100644 --- a/tests/test_sourmash.py +++ b/tests/test_sourmash.py @@ -4006,6 +4006,8 @@ def test_gather_abund_1_1(runtmp, linear_gather, prefetch_gather): assert '50.4% 80.0% 1.9 tests/test-data/genome-s11.fa.gz' in out assert 'genome-s12.fa.gz' not in out + assert "the recovered matches hit 100.0% of the abundance-weighted query" in out + def test_gather_abund_10_1(runtmp, prefetch_gather, linear_gather): c = runtmp @@ -4041,6 +4043,7 @@ def test_gather_abund_10_1(runtmp, prefetch_gather, linear_gather): assert '91.0% 100.0% 14.5 tests/test-data/genome-s10.fa.gz' in out assert '9.0% 80.0% 1.9 tests/test-data/genome-s11.fa.gz' in out assert 'genome-s12.fa.gz' not in out + assert "the recovered matches hit 100.0% of the abundance-weighted query" in out # check the calculations behind the above output by looking into # the CSV. @@ -4108,6 +4111,7 @@ def test_gather_abund_10_1_ignore_abundance(runtmp, linear_gather, prefetch_gath print(out) print(err) + assert "the recovered matches hit 100.0% of the query (unweighted)" in out # when we project s10x10-s11 (r2+r3), 10:1 abundance, # onto s10 and s11 genomes with gather --ignore-abundance, we get: