@@ -343,9 +343,11 @@ def test_cigar_hit_ref_cut_add_prop_exhaustive(hit, cut_point):
343
343
('4D6I5M@1->1' , '4D5M@7->1' ),
344
344
('4I6D5M@1->1' , '6D5M@5->1' ),
345
345
('6I4D@1->1' , '4D@7->1' ),
346
- ('6D4I@1->1' , '6D4I@1 ->1' ),
347
- ('4D6I@1->1' , '4D6I@1 ->1' ),
346
+ ('6D4I@1->1' , '6D@5 ->1' ),
347
+ ('4D6I@1->1' , '4D@7 ->1' ),
348
348
('4I6D@1->1' , '6D@5->1' ),
349
+ ('4I@1->1' , '@5->1' ),
350
+ ('4D@1->1' , '4D@1->1' ),
349
351
('@1->1' , '@1->1' ),
350
352
]
351
353
@@ -364,9 +366,11 @@ def test_cigar_hit_ref_cut_add_prop_exhaustive(hit, cut_point):
364
366
('5M6D4I@1->1' , '5M6D@1->1' ),
365
367
('5M6I4D@1->1' , '5M4D@1->1' ),
366
368
('6D4I@1->1' , '6D@1->1' ),
367
- ('6I4D@1->1' , '6I4D @1->1' ),
368
- ('4I6D@1->1' , '4I6D @1->1' ),
369
+ ('6I4D@1->1' , '4D @1->1' ),
370
+ ('4I6D@1->1' , '6D @1->1' ),
369
371
('4D6I@1->1' , '4D@1->1' ),
372
+ ('4I@1->1' , '@1->1' ),
373
+ ('4D@1->1' , '4D@1->1' ),
370
374
('@1->1' , '@1->1' ),
371
375
]
372
376
@@ -384,10 +388,12 @@ def test_cigar_hit_ref_cut_add_prop_exhaustive(hit, cut_point):
384
388
('3I2D3I2D5M@1->1' , '6I5M@1->5' ),
385
389
('4D6I5M@1->1' , '6I5M@1->5' ),
386
390
('4I6D5M@1->1' , '4I5M@1->7' ),
387
- ('6I4D@1->1' , '6I4D @1->1 ' ),
391
+ ('6I4D@1->1' , '6I @1->5 ' ),
388
392
('6D4I@1->1' , '4I@1->7' ),
389
393
('4D6I@1->1' , '6I@1->5' ),
390
- ('4I6D@1->1' , '4I6D@1->1' ),
394
+ ('4I6D@1->1' , '4I@1->7' ),
395
+ ('4I@1->1' , '4I@1->1' ),
396
+ ('4D@1->1' , '@1->5' ),
391
397
('@1->1' , '@1->1' ),
392
398
]
393
399
@@ -405,10 +411,12 @@ def test_cigar_hit_ref_cut_add_prop_exhaustive(hit, cut_point):
405
411
('5M2D3I2D3I@1->1' , '5M6I@1->1' ),
406
412
('5M6D4I@1->1' , '5M4I@1->1' ),
407
413
('5M6I4D@1->1' , '5M6I@1->1' ),
408
- ('6D4I@1->1' , '6D4I @1->1' ),
414
+ ('6D4I@1->1' , '4I @1->1' ),
409
415
('6I4D@1->1' , '6I@1->1' ),
410
416
('4I6D@1->1' , '4I@1->1' ),
411
- ('4D6I@1->1' , '4D6I@1->1' ),
417
+ ('4D6I@1->1' , '6I@1->1' ),
418
+ ('4I@1->1' , '4I@1->1' ),
419
+ ('4D@1->1' , '@1->1' ),
412
420
('@1->1' , '@1->1' ),
413
421
]
414
422
@@ -493,8 +501,12 @@ def test_cigar_hit_reference_strip_is_idempotent(hit):
493
501
def test_cigar_hit_reference_strips_are_commutative (hit ):
494
502
hit = parsed_hit (hit )
495
503
496
- assert hit .rstrip_reference ().lstrip_reference () \
497
- == hit .lstrip_reference ().rstrip_reference ()
504
+ if len (hit .cigar .coordinate_mapping .ref_to_query ) > 0 :
505
+ assert hit .rstrip_reference ().lstrip_reference () \
506
+ == hit .lstrip_reference ().rstrip_reference ()
507
+ else :
508
+ assert hit .rstrip_reference ().lstrip_reference ().cigar \
509
+ == hit .lstrip_reference ().rstrip_reference ().cigar
498
510
499
511
500
512
@pytest .mark .parametrize ('hit, expected' , lstrip_query_cases )
@@ -540,13 +552,13 @@ def test_cigar_hit_query_strip_combines_with_add(hit):
540
552
541
553
542
554
@pytest .mark .parametrize ('hit' , strip_prop_cases_all )
543
- def test_cigar_hit_query_strip_never_crashes (hit ):
555
+ def test_cigar_hit_strips_work_together (hit ):
544
556
hit = parsed_hit (hit )
545
557
546
- hit .rstrip_query ().lstrip_query ( )
547
- hit . lstrip_query (). rstrip_query ( )
548
- hit .lstrip_query ().lstrip_query ( )
549
- hit . rstrip_query (). rstrip_query ( )
558
+ rstrip = str ( hit .rstrip_query ().rstrip_reference (). cigar )
559
+ assert not rstrip . endswith ( "I" ) and not rstrip . endswith ( "D" )
560
+ lstrip = str ( hit .lstrip_query ().lstrip_reference (). cigar )
561
+ assert not lstrip . startswith ( "I" ) and not lstrip . startswith ( "D" )
550
562
551
563
552
564
@pytest .mark .parametrize ('hit' , strip_prop_cases_all )
@@ -570,8 +582,12 @@ def test_cigar_hit_query_strip_is_idempotent(hit):
570
582
def test_cigar_hit_query_strips_are_commutative (hit ):
571
583
hit = parsed_hit (hit )
572
584
573
- assert hit .rstrip_query ().lstrip_query () \
574
- == hit .lstrip_query ().rstrip_query ()
585
+ if len (hit .cigar .coordinate_mapping .ref_to_query ) > 0 :
586
+ assert hit .rstrip_query ().lstrip_query () \
587
+ == hit .lstrip_query ().rstrip_query ()
588
+ else :
589
+ assert hit .rstrip_query ().lstrip_query ().cigar \
590
+ == hit .lstrip_query ().rstrip_query ().cigar
575
591
576
592
577
593
@pytest .mark .parametrize ('hit, cut_point' , [(x [0 ], x [1 ]) for x in cigar_hit_ref_cut_cases
0 commit comments