Skip to content

Commit

Permalink
fix weird failing gather
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb committed Nov 1, 2023
1 parent 7e8198b commit b517deb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/sourmash/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ def gather(args):
if prefetch_csvout_fp:
for found_sig in counter.signatures():
# calculate intersection stats and info
prefetch_result = PrefetchResult(prefetch_query, found_sig, cmp_scaled=scaled,
prefetch_result = PrefetchResult(prefetch_query, found_sig,
threshold_bp=args.threshold_bp, estimate_ani_ci=args.estimate_ani_ci)
if prefetch_csvout_w is None:
prefetch_csvout_w = prefetch_result.init_dictwriter(prefetch_csvout_fp)
Expand Down
7 changes: 5 additions & 2 deletions src/sourmash/index/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,15 +807,18 @@ def peek(self, cur_query_mh, *, threshold_bp=0):
if match_size < n_threshold_hashes:
return []

## at this point, we have a legitimate match above threshold!
## at this point, we should have a legitimate match above threshold!
# @CTB

# pull match and location.
match = siglist[dataset_id]

# calculate containment
# CTB: this check is probably redundant with intersect_mh calc, below.
cont = cur_query_mh.contained_by(match.minhash, downsample=True)
assert cont
if cont == 0:
return []

Check warning on line 820 in src/sourmash/index/__init__.py

View check run for this annotation

Codecov / codecov/patch

src/sourmash/index/__init__.py#L820

Added line #L820 was not covered by tests

assert cont >= threshold

# calculate intersection of this "best match" with query.
Expand Down

0 comments on commit b517deb

Please sign in to comment.