Skip to content

Commit

Permalink
[MRG] fix query_abundance column when --ignore-abundance is set (#…
Browse files Browse the repository at this point in the history
…2251)

* check query_abundance when gather --ignore-abund is set

* check values for flat query
  • Loading branch information
ctb authored Sep 7, 2022
1 parent beb96a3 commit 3880109
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/sourmash/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 6 additions & 0 deletions tests/test_sourmash.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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


Expand Down

0 comments on commit 3880109

Please sign in to comment.