Skip to content

Commit 208316c

Browse files
committed
Cigar tools: rename "gaps()" to "deletions()"
1 parent ce03442 commit 208316c

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

micall/core/contig_stitcher.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ def significant(gap):
590590
return gap.ref_length > 5
591591

592592
def try_split(contig):
593-
for gap in contig.alignment.gaps():
593+
for gap in contig.alignment.deletions():
594594
if not significant(gap):
595595
# Really we do not want to split on every little deletion
596596
# because that would mean that we would need to stitch

micall/tests/test_cigar_tools.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ def test_cigar_hit_ref_cut_add_associativity(hit, cut_point):
451451
if not isinstance(x[2], Exception)])
452452
def test_cigar_hit_gaps_no_m_or_i(hit):
453453
hit = parsed_hit(hit)
454-
gaps = list(hit.gaps())
454+
gaps = list(hit.deletions())
455455

456456
if 'D' in str(hit.cigar):
457457
assert len(gaps) > 0
@@ -465,7 +465,7 @@ def test_cigar_hit_gaps_no_m_or_i(hit):
465465
if not isinstance(x[2], Exception)])
466466
def test_cigar_hit_gaps_lengths(hit):
467467
hit = parsed_hit(hit)
468-
gaps = list(hit.gaps())
468+
gaps = list(hit.deletions())
469469

470470
for gap in gaps:
471471
assert gap.query_length == 0

micall/tests/test_contig_stitcher.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -502,12 +502,12 @@ def test_stitching_contig_with_big_covered_gap(exact_aligner, visualizer):
502502

503503
contigs = list(align_all_to_reference(contigs))
504504
assert len(contigs) == 2
505-
assert len(list(contigs[0].alignment.gaps())) == 1
506-
assert len(list(contigs[1].alignment.gaps())) == 0
505+
assert len(list(contigs[0].alignment.deletions())) == 1
506+
assert len(list(contigs[1].alignment.deletions())) == 0
507507

508508
results = list(split_contigs_with_gaps(contigs))
509509
assert len(results) == 3
510-
assert all(list(contig.alignment.gaps()) == [] for contig in results)
510+
assert all(list(contig.alignment.deletions()) == [] for contig in results)
511511

512512
assert len(visualizer().elements) > len(contigs)
513513

@@ -536,8 +536,8 @@ def test_stitching_contig_with_small_covered_gap(exact_aligner, visualizer):
536536

537537
contigs = list(align_all_to_reference(contigs))
538538
assert len(contigs) == 2
539-
assert len(list(contigs[0].alignment.gaps())) == 1
540-
assert len(list(contigs[1].alignment.gaps())) == 0
539+
assert len(list(contigs[0].alignment.deletions())) == 1
540+
assert len(list(contigs[1].alignment.deletions())) == 0
541541
results = list(split_contigs_with_gaps(contigs))
542542
assert len(results) == 3
543543

micall/utils/cigar_tools.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ def touches(self, other) -> bool:
520520
and self.q_ei + 1 == other.q_st
521521

522522

523-
def gaps(self) -> Iterable['CigarHit']:
523+
def deletions(self) -> Iterable['CigarHit']:
524524
# TODO(vitalik): memoize whatever possible.
525525

526526
covered_coordinates = self.coordinate_mapping.ref_to_query.keys()

0 commit comments

Comments
 (0)