Skip to content

Commit

Permalink
Replace deletions with previous consensus, part of #393.
Browse files Browse the repository at this point in the history
  • Loading branch information
donkirkby committed Jul 27, 2017
1 parent d9ccf04 commit ed6966c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
5 changes: 4 additions & 1 deletion micall/core/remap.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,10 @@ def counts_to_conseqs(refmap, seeds=None):
else:
conseq += seed[pos-1]
elif most_common == '-':
deletion += '-'
if seed is None:
deletion += '-'
else:
conseq += seed[pos-1]
else:
if deletion:
if len(deletion) % 3 != 0:
Expand Down
28 changes: 28 additions & 0 deletions micall/tests/remap_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,34 @@ def testSeedsWithLowQuality(self):

self.assertDictEqual(expected_conseqs, conseqs)

def testSeedsWithPartialDeletion(self):
samIO = StringIO(
"@SQ\tSN:test\n"
"test1\t99\ttest\t4\t44\t1M1D1M\t=\t10\t3\tTT\tJJ\n"
)
seeds = {'test': 'ACATTTGGGCAC'}
expected_conseqs = {'test': 'ACATTTGGGCAC'}

conseqs = remap.sam_to_conseqs(samIO,
seeds=seeds,
quality_cutoff=32)

self.assertDictEqual(expected_conseqs, conseqs)

def testSeedsWithCodonDeletion(self):
samIO = StringIO(
"@SQ\tSN:test\n"
"test1\t99\ttest\t1\t44\t3M3D3M\t=\t10\t6\tACAGGG\tJJJJJJ\n"
)
seeds = {'test': 'ACATTTGGGCAC'}
expected_conseqs = {'test': 'ACATTTGGGCAC'}

conseqs = remap.sam_to_conseqs(samIO,
seeds=seeds,
quality_cutoff=32)

self.assertDictEqual(expected_conseqs, conseqs)

def testDebugReports(self):
samIO = StringIO(
"@SQ\tSN:test\n"
Expand Down

0 comments on commit ed6966c

Please sign in to comment.