From 3880109527f0ce1ca43e0c330e5671ec36504b24 Mon Sep 17 00:00:00 2001 From: "C. Titus Brown" Date: Tue, 6 Sep 2022 17:07:14 -0700 Subject: [PATCH] [MRG] fix `query_abundance` column when `--ignore-abundance` is set (#2251) * check query_abundance when gather --ignore-abund is set * check values for flat query --- src/sourmash/search.py | 1 + tests/test_sourmash.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/sourmash/search.py b/src/sourmash/search.py index 49b3024235..e392d5469b 100644 --- a/src/sourmash/search.py +++ b/src/sourmash/search.py @@ -507,6 +507,7 @@ def build_gather_result(self): self.f_unique_weighted = self.n_unique_weighted_found / self.total_weighted_hashes else: self.f_unique_weighted = self.f_unique_to_query + self.query_abundance = False def __post_init__(self): self.check_gatherresult_input() diff --git a/tests/test_sourmash.py b/tests/test_sourmash.py index 4d635f1d7a..857d31b116 100644 --- a/tests/test_sourmash.py +++ b/tests/test_sourmash.py @@ -3151,6 +3151,9 @@ def test_gather_csv(runtmp, linear_gather, prefetch_gather): assert row['query_md5'] == 'c9d5a795' assert row['query_bp'] == '910' + assert row['query_abundance'] == 'False' + assert row['n_unique_weighted_found'] == '' + def test_gather_csv_gz(runtmp, linear_gather, prefetch_gather): # test 'gather -o csvfile.gz' @@ -4718,6 +4721,9 @@ def test_gather_abund_10_1_ignore_abundance(runtmp, linear_gather, prefetch_gath assert row['median_abund'] == '' assert row['std_abund'] == '' + assert row['query_abundance'] == 'False', row['query_abundance'] + assert row['n_unique_weighted_found'] == '' + assert some_results