Skip to content

Commit

Permalink
[MRG] Fix sourmash prefetch for multiple ksizes in database (#1866)
Browse files Browse the repository at this point in the history
* add test that breaks prefetch b/c of multiple ksizes

* fix prefetch
  • Loading branch information
ctb authored Mar 7, 2022
1 parent 186fc1f commit 234df70
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/sourmash/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,7 @@ def prefetch(args):
sys.exit(-1)

query.minhash = query_mh
ksize = query_mh.ksize

# set up CSV output, write headers, etc.
csvout_fp = None
Expand Down
15 changes: 15 additions & 0 deletions tests/test_prefetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@ def test_prefetch_basic(runtmp, linear_gather):
assert "a total of 0 query hashes remain unmatched." in c.last_result.err


def test_prefetch_select_query_ksize(runtmp, linear_gather):
# test prefetch where query and subject db both have multiple ksizes
c = runtmp

ss = utils.get_test_data('GCF_000005845.2_ASM584v2_genomic.fna.gz.sig')

c.run_sourmash('prefetch', ss, ss, linear_gather)
print(c.last_result.status)
print(c.last_result.out)
print(c.last_result.err)

assert c.last_result.status == 0
assert 'of 4476 distinct query hashes, 4476 were found in matches above threshold.' in c.last_result.err


def test_prefetch_query_abund(runtmp, linear_gather):
c = runtmp

Expand Down

0 comments on commit 234df70

Please sign in to comment.