@@ -337,14 +337,14 @@ def compute_alignment_and_score(
337
337
338
338
# Cutoff computation helpers
339
339
def cutoffs_left_covered (
340
- minimum_score : Score ,
340
+ minimum_acceptable : Score ,
341
341
left : ContigWithAligner ,
342
342
right : ContigWithAligner ,
343
343
shift : int ,
344
344
left_initial_overlap : str ,
345
345
) -> Tuple [int , int ]:
346
346
overlap_alignments = tuple (
347
- map_overlap (right , minimum_score , "cover" , left_initial_overlap )
347
+ map_overlap (right , minimum_acceptable , "cover" , left_initial_overlap )
348
348
)
349
349
right_cutoff = max ((end for start , end in overlap_alignments ), default = - 1 )
350
350
if right_cutoff < 0 :
@@ -357,14 +357,14 @@ def cutoffs_left_covered(
357
357
358
358
359
359
def cutoffs_right_covered (
360
- minimum_score : Score ,
360
+ minimum_acceptable : Score ,
361
361
left : ContigWithAligner ,
362
362
right : ContigWithAligner ,
363
363
shift : int ,
364
364
right_initial_overlap : str ,
365
365
) -> Tuple [int , int ]:
366
366
overlap_alignments = tuple (
367
- map_overlap (left , minimum_score , "cover" , right_initial_overlap )
367
+ map_overlap (left , minimum_acceptable , "cover" , right_initial_overlap )
368
368
)
369
369
left_cutoff = min ((start for start , end in overlap_alignments ), default = - 1 )
370
370
if left_cutoff < 0 :
@@ -377,20 +377,20 @@ def cutoffs_right_covered(
377
377
378
378
379
379
def cutoffs_left_shorter (
380
- minimum_score : Score ,
380
+ minimum_acceptable : Score ,
381
381
left : ContigWithAligner ,
382
382
right : ContigWithAligner ,
383
383
left_initial_overlap : str ,
384
384
right_initial_overlap : str ,
385
385
) -> Optional [Tuple [int , int ]]:
386
386
left_overlap_alignments = map_overlap (
387
- left , minimum_score , "left" , right_initial_overlap
387
+ left , minimum_acceptable , "left" , right_initial_overlap
388
388
)
389
389
left_cutoff = min ((start for start , end in left_overlap_alignments ), default = - 1 )
390
390
if left_cutoff < 0 :
391
391
return None
392
392
right_overlap_alignments = map_overlap (
393
- right , minimum_score , "right" , left_initial_overlap
393
+ right , minimum_acceptable , "right" , left_initial_overlap
394
394
)
395
395
right_cutoff = max ((end for start , end in right_overlap_alignments ), default = - 1 )
396
396
if right_cutoff < 0 :
@@ -399,20 +399,20 @@ def cutoffs_left_shorter(
399
399
400
400
401
401
def cutoffs_right_shorter_or_equal (
402
- minimum_score : Score ,
402
+ minimum_acceptable : Score ,
403
403
left : ContigWithAligner ,
404
404
right : ContigWithAligner ,
405
405
left_initial_overlap : str ,
406
406
right_initial_overlap : str ,
407
407
) -> Optional [Tuple [int , int ]]:
408
408
right_overlap_alignments = map_overlap (
409
- right , minimum_score , "right" , left_initial_overlap
409
+ right , minimum_acceptable , "right" , left_initial_overlap
410
410
)
411
411
right_cutoff = max ((end for start , end in right_overlap_alignments ), default = - 1 )
412
412
if right_cutoff < 0 :
413
413
return None
414
414
left_overlap_alignments = map_overlap (
415
- left , minimum_score , "left" , right_initial_overlap
415
+ left , minimum_acceptable , "left" , right_initial_overlap
416
416
)
417
417
left_cutoff = min ((start for start , end in left_overlap_alignments ), default = - 1 )
418
418
if left_cutoff < 0 :
@@ -421,7 +421,7 @@ def cutoffs_right_shorter_or_equal(
421
421
422
422
423
423
def compute_overlap_cutoffs (
424
- minimum_score : Score ,
424
+ minimum_acceptable : Score ,
425
425
left : ContigWithAligner ,
426
426
right : ContigWithAligner ,
427
427
shift : int ,
@@ -430,23 +430,23 @@ def compute_overlap_cutoffs(
430
430
) -> Optional [Tuple [int , int ]]:
431
431
if len (left .seq ) == len (left_initial_overlap ):
432
432
return cutoffs_left_covered (
433
- minimum_score , left , right , shift , left_initial_overlap
433
+ minimum_acceptable , left , right , shift , left_initial_overlap
434
434
)
435
435
if len (right .seq ) == len (right_initial_overlap ):
436
436
return cutoffs_right_covered (
437
- minimum_score , left , right , shift , right_initial_overlap
437
+ minimum_acceptable , left , right , shift , right_initial_overlap
438
438
)
439
439
if len (left .seq ) < len (right .seq ):
440
440
return cutoffs_left_shorter (
441
- minimum_score , left , right , left_initial_overlap , right_initial_overlap
441
+ minimum_acceptable , left , right , left_initial_overlap , right_initial_overlap
442
442
)
443
443
return cutoffs_right_shorter_or_equal (
444
- minimum_score , left , right , left_initial_overlap , right_initial_overlap
444
+ minimum_acceptable , left , right , left_initial_overlap , right_initial_overlap
445
445
)
446
446
447
447
448
448
def find_overlap_cutoffs (
449
- minimum_score : Score ,
449
+ minimum_acceptable : Score ,
450
450
left : ContigWithAligner ,
451
451
right : ContigWithAligner ,
452
452
shift : int ,
@@ -462,28 +462,29 @@ def find_overlap_cutoffs(
462
462
463
463
Caching:
464
464
Results are cached per (left.id, right.id). When no valid overlap region
465
- is possible for the given pair (under `minimum_score`) , a None entry is
465
+ is possible for the given pair, a None entry is
466
466
recorded and None is returned on subsequent calls.
467
467
468
468
Returns:
469
469
Tuple (left_cutoff, right_cutoff) on success, or None if no valid
470
- overlap region satisfies the minimum score.
470
+ overlap region satisfies the minimum acceptable score or something lower than it .
471
471
"""
472
472
473
473
# Note:
474
- # It is fine to omit `minimum_score ` from the cache key because
475
- # the cutoffs are monotonic with respect to `minimum_score `.
476
- # Increasing `minimum_score ` can only reduce the valid overlap region,
474
+ # It is fine to omit `minimum_acceptable ` from the cache key because
475
+ # the cutoffs are monotonic with respect to `minimum_acceptable `.
476
+ # Increasing `minimum_acceptable ` can only reduce the valid overlap region,
477
477
# never expand it. Therefore, the cutoffs computed for a lower
478
- # `minimum_score` are always valid for a higher one.
478
+ # `minimum_acceptable` are always valid for a higher one.
479
+ # The `minimum_acceptable` is monotonic.
479
480
key = (left .id , right .id )
480
481
existing = cutoffs_cache .get (key , - 1 )
481
482
if existing != - 1 :
482
483
ret : CutoffsCacheResult = existing # type: ignore[assignment]
483
484
return ret
484
485
485
486
value = compute_overlap_cutoffs (
486
- minimum_score , left , right , shift , left_initial_overlap , right_initial_overlap
487
+ minimum_acceptable , left , right , shift , left_initial_overlap , right_initial_overlap
487
488
)
488
489
cutoffs_cache [key ] = value
489
490
return value
@@ -622,7 +623,7 @@ def try_combine_contigs(
622
623
left , right , shift , left_initial_overlap , right_initial_overlap , overlap = prepared
623
624
624
625
cutoffs = find_overlap_cutoffs (
625
- minimum_base_score ,
626
+ pool . min_acceptable_score ,
626
627
left ,
627
628
right ,
628
629
shift ,
0 commit comments