Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EXP] try out making a cover for the prefetch results #1853

Open
wants to merge 1 commit into
base: latest
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/sourmash/index/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,13 +717,27 @@ def __init__(self, query_mh):
# cannot add matches once query has started.
self.query_started = 0

self.seen = set()

def add(self, ss, location=None, require_overlap=True):
"Add this signature in as a potential match."
if self.query_started:
raise ValueError("cannot add more signatures to counter after peek/consume")

# @CTB
cmp_mh = ss.minhash.downsample(scaled=self.orig_query_mh.scaled)
if 1:
hashes = set(ss.minhash.hashes)
hashes = hashes - self.seen
self.seen.update(hashes)
if len(hashes) != len(ss.minhash):
print('DIFF', len(self.seen))
new_mh = ss.minhash.copy_and_clear()
new_mh.add_many(hashes)
cmp_mh = new_mh

# upon insertion, count & track overlap with the specific query.
overlap = self.orig_query_mh.count_common(ss.minhash, True)
overlap = self.orig_query_mh.count_common(cmp_mh, True)
if overlap:
i = len(self.siglist)

Expand Down