Skip to content

Commit

Permalink
test and fix gather x abund signatures (#1519)
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb authored May 13, 2021
1 parent 1633121 commit 3b8793c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/sourmash/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def gather_databases(query, counters, threshold_bp, ignore_abundance):
# (CTB note: this means that if a high scaled/low res signature is
# found early on, resolution will be low from then on.)
query_mh = query.minhash.downsample(scaled=cmp_scaled)
found_mh = best_match.minhash.downsample(scaled=cmp_scaled)
found_mh = best_match.minhash.downsample(scaled=cmp_scaled).flatten()
orig_query_mh = orig_query_mh.downsample(scaled=cmp_scaled)
sum_abunds = sum(( orig_query_abunds[k] for k in orig_query_mh.hashes ))

Expand Down
9 changes: 9 additions & 0 deletions tests/test_sourmash.py
Original file line number Diff line number Diff line change
Expand Up @@ -2919,6 +2919,15 @@ def test_gather_csv(linear_gather, prefetch_gather):
assert row['gather_result_rank'] == '0'


def test_gather_abund_x_abund(runtmp, prefetch_gather, linear_gather):
sig47 = utils.get_test_data('track_abund/47.fa.sig')
sig63 = utils.get_test_data('track_abund/63.fa.sig')

runtmp.sourmash('gather', sig47, sig63)

assert '2.5 Mbp 49.2% 48.3% 1.0 NC_011663.1' in runtmp.last_result.out


def test_gather_multiple_sbts(prefetch_gather, linear_gather):
with utils.TempDirectory() as location:
testdata1 = utils.get_test_data('short.fa')
Expand Down

0 comments on commit 3b8793c

Please sign in to comment.