Skip to content

Commit

Permalink
Contig stitcher: remove unused aligned_seq field
Browse files Browse the repository at this point in the history
  • Loading branch information
Donaim committed Nov 15, 2023
1 parent 713df5d commit 87d2d4d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
6 changes: 0 additions & 6 deletions micall/core/contig_stitcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ def __init__(self, query: GenotypedContig, alignment: CigarHit):
matched_fraction = query.matched_fraction)


@cached_property
def aligned_seq(self):
ref_msa, query_msa = self.alignment.to_msa(self.query.ref_seq, self.query.seq)
return ''.join((c for c in query_msa if c != '-'))


def cut_reference(self, cut_point: float) -> Tuple['AlignedContig', 'AlignedContig']:
""" Cuts this alignment in two parts with cut_point between them. """

Expand Down
8 changes: 4 additions & 4 deletions micall/tests/test_contig_stitcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def test_stitching_contig_with_small_covered_gap(exact_aligner):

results = list(split_contigs_with_gaps(contigs))

assert all(x.seq == x.aligned_seq for x in results)
assert all(x.seq == x.lstrip_query().rstrip_query().seq for x in results)

assert set(map(lambda x: x.seq, contigs)) \
== set(map(lambda x: x.seq, results))
Expand All @@ -463,10 +463,10 @@ def test_stitching_partial_align(exact_aligner):
for result in results:
assert any(result.seq in contig.seq for contig in contigs)

assert all(x.seq != x.aligned_seq for x in results)
assert all(x.seq != x.lstrip_query().rstrip_query().seq for x in results)

assert set(map(lambda x: x.seq, contigs)) \
!= set(map(lambda x: x.aligned_seq, results))
!= set(map(lambda x: x.lstrip_query().rstrip_query().seq, results))


def test_partial_align_consensus(exact_aligner):
Expand Down Expand Up @@ -513,7 +513,7 @@ def test_stitching_partial_align_multiple_sequences(exact_aligner):
assert any(result.seq in contig.seq for contig in contigs)

assert set(map(lambda x: x.seq, contigs)) \
!= set(map(lambda x: x.aligned_seq, results))
!= set(map(lambda x: x.lstrip_query().rstrip_query().seq, results))


def test_partial_align_consensus_multiple_sequences(exact_aligner):
Expand Down

0 comments on commit 87d2d4d

Please sign in to comment.