Skip to content

Commit 6eb159b

Browse files
committed
trial replacing internal CounterGather python impl with RevIndex
1 parent 5be40be commit 6eb159b

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/sourmash/index/__init__.py

+15-6
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,22 @@ def counter_gather(self, query, threshold_bp, **kwargs):
311311
with query.update() as prefetch_query:
312312
prefetch_query.minhash = prefetch_query.minhash.flatten()
313313

314-
# find all matches and construct a CounterGather object.
315-
counter = CounterGather(prefetch_query)
316-
for result in self.prefetch(prefetch_query, threshold_bp, **kwargs):
317-
counter.add(result.signature, location=result.location)
314+
if 0: # @CTB
315+
# find all matches and construct a CounterGather object.
316+
counter = CounterGather(prefetch_query)
317+
for result in self.prefetch(prefetch_query, threshold_bp, **kwargs):
318+
counter.add(result.signature, location=result.location)
319+
320+
# tada!
321+
return counter
322+
else:
323+
from .revindex import RevIndex
324+
revindex = RevIndex(template=prefetch_query.minhash)
325+
326+
for result in self.prefetch(prefetch_query, threshold_bp, **kwargs):
327+
revindex.insert(result.signature)
318328

319-
# tada!
320-
return counter
329+
return revindex.counter_gather(prefetch_query, threshold_bp)
321330

322331
@abstractmethod
323332
def select(

0 commit comments

Comments
 (0)