Skip to content

Commit

Permalink
Add tests for the new contig stitcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Donaim committed Nov 7, 2023
1 parent a42f4aa commit 5041750
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions micall/tests/test_contig_stitcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,49 @@ def test_1():
result = list(stitch_contigs(contigs))
assert sorted(map(lambda x: x.seq, contigs)) \
== sorted(map(lambda x: x.seq, result))


def test_2():
ref_seq = 'A' * 100

contigs = [
GenotypedContig(name='a',
seq=ref_seq,
ref_name='testref',
ref_seq=ref_seq,
matched_fraction=0.5,
),
GenotypedContig(name='b',
seq='C' * 100,
ref_name='testref',
ref_seq=ref_seq,
matched_fraction=0.5,
),
]

result = list(stitch_contigs(contigs))
assert sorted(map(lambda x: x.seq, contigs)) \
== sorted(map(lambda x: x.seq, result))


def test_3():
ref_seq = 'A' * 100 + 'C' * 100

contigs = [
GenotypedContig(name='a',
seq='A' * 50 + 'C' * 20,
ref_name='testref',
ref_seq=ref_seq,
matched_fraction=0.5,
),
GenotypedContig(name='b',
seq='A' * 20 + 'C' * 50,
ref_name='testref',
ref_seq=ref_seq,
matched_fraction=0.5,
),
]

result = list(stitch_contigs(contigs))
assert 100 == sum(len(x.seq) for x in result)
assert result[0].contig.name == 'a+overlap(a,b)+b'

0 comments on commit 5041750

Please sign in to comment.