Skip to content

Commit

Permalink
Merge pull request #251 from dib-lab/no-mate-prefilt
Browse files Browse the repository at this point in the history
Do not filter with mate distance before likelihood is calculated
  • Loading branch information
standage committed Apr 23, 2018
2 parents c01e378 + 0cbf1fa commit 0dbf973
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 0 additions & 2 deletions kevlar/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ def prelim_call(targetlist, querylist, match=1, mismatch=2, gapopen=5,
for varcall in alignment.call_variants(ksize, mindist, logstream):
if alignment.matedist:
varcall.annotate('MD', '{:.2f}'.format(alignment.matedist))
if n > 0:
varcall.filter(vf.MateFail)
yield varcall


Expand Down
19 changes: 11 additions & 8 deletions kevlar/tests/test_alac.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,25 @@ def test_alac_bigpart():
assert len(calls) == 3


@pytest.mark.parametrize('cc,numrawcalls,numfiltcalls', [
('26849', 4, 2),
('138713', 14, 1),
@pytest.mark.parametrize('cc,numcalls,numdist,numinf', [
('26849', 4, 2, 0),
('138713', 14, 14, 10),
])
def test_alac_inf_mate_dist(cc, numrawcalls, numfiltcalls):
def test_alac_inf_mate_dist(cc, numcalls, numdist, numinf):
readfile = data_file('inf-mate-dist/cc{}.augfastq.gz'.format(cc))
refrfile = data_file('inf-mate-dist/cc{}.genome.fa.gz'.format(cc))
readstream = kevlar.parse_augmented_fastx(kevlar.open(readfile, 'r'))
partstream = kevlar.parse_partitioned_reads(readstream)
caller = kevlar.alac.alac(partstream, refrfile, ksize=31, delta=50,
seedsize=51, fallback=True)
calls = list(caller)
print(*[c.vcf for c in calls], sep='\n', file=sys.stderr)
assert len(calls) == numrawcalls
filtcalls = [c for c in calls if c.filterstr == 'PASS']
assert len(filtcalls) == numfiltcalls
withdist = [c for c in calls if c.attribute('MD') is not None]
infdist = [c for c in calls if c.attribute('MD') == 'inf']
print('DEBUG total withdist infdist', len(calls), len(withdist),
len(infdist), file=sys.stderr)
assert len(calls) == numcalls
assert len(withdist) == numdist
assert len(infdist) == numinf


def test_alac_no_mates():
Expand Down

0 comments on commit 0dbf973

Please sign in to comment.