@@ -289,6 +289,23 @@ def binary_search(index_filename: Path,
289
289
# Otherwise keep the current unique length
290
290
unique_lengths [counted_positions ])
291
291
292
+ # If we have a k-mer count of 1 and the current length queried is the
293
+ # same as the lower bound (i.e. can't get smaller for a unique count)
294
+ # This position has finished searching
295
+ finished_search [counted_positions ] = np .where (
296
+ count_list == 1 ,
297
+ current_length_query [counted_positions ] == lower_length_bound [counted_positions ],
298
+ finished_search [counted_positions ])
299
+
300
+ # If we have a k-mer count > 1 and the current length queried is the
301
+ # same as the uppper bound (i.e. can't find a unique length or larger)
302
+ # This position has finished searching
303
+ finished_search [counted_positions ] = np .where (
304
+ count_list > 1 ,
305
+ current_length_query [counted_positions ] == upper_length_bound [counted_positions ],
306
+ finished_search [counted_positions ])
307
+
308
+
292
309
# Update the query length and bounds for the next iteration
293
310
294
311
# Lower the upper bounds of our search range on positions where
@@ -314,13 +331,6 @@ def binary_search(index_filename: Path,
314
331
(upper_length_bound [counted_positions ] / 2 ) +
315
332
(lower_length_bound [counted_positions ] / 2 )).astype (data_type )
316
333
317
- # If we have reduced our bounds to overlapping we have finished
318
- # searching on this position
319
- finished_search [counted_positions ] = \
320
- finished_search [counted_positions ] | \
321
- (upper_length_bound [counted_positions ] <
322
- lower_length_bound [counted_positions ])
323
-
324
334
iteration_count += 1
325
335
326
336
verbose_print (verbose ,
0 commit comments