Skip to content

Commit

Permalink
Add test for checking CigarHit.gaps() lengths
Browse files Browse the repository at this point in the history
  • Loading branch information
Donaim committed Nov 14, 2023
1 parent 7f3cdc0 commit eb712a3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion micall/tests/test_cigar_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import itertools

from micall.utils.consensus_aligner import CigarActions
from micall.utils.cigar_tools import Cigar, CigarHit, connect_cigar_hits
from micall.utils.cigar_tools import Cigar, CigarHit, connect_cigar_hits, CoordinateMapping


cigar_mapping_cases = [
Expand Down Expand Up @@ -383,6 +383,17 @@ def test_cigar_hit_gaps_no_m_or_i(hit):
assert 'I' not in str(gap.cigar)


@pytest.mark.parametrize('hit', [x[0] for x in cigar_hit_ref_cut_cases
if not isinstance(x[2], Exception)])
def test_cigar_hit_gaps_lengths(hit):
gaps = list(hit.gaps())

for gap in gaps:
assert gap.query_length == 0
assert gap.ref_length > 0
assert gap.coordinate_mapping == CoordinateMapping()


@pytest.mark.parametrize("reference_seq, query_seq, cigar, expected_reference, expected_query", [
('ACTG', 'ACTG', '4M', 'ACTG', 'ACTG'),
('ACTG', '', '4D', 'ACTG', '----'),
Expand Down

0 comments on commit eb712a3

Please sign in to comment.