Skip to content

Commit

Permalink
Merge pull request #266 from dib-lab/filter/lowlik
Browse files Browse the repository at this point in the history
Apply filter to variant calls with LIKESCORE < 0. Closes #253.
  • Loading branch information
standage committed Jun 13, 2018
2 parents 8ae3c4a + af28256 commit fe18a13
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions kevlar/simlike.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ def simlike(variants, case, controls, refr, mu=30.0, sigma=8.0, epsilon=0.001,

allcalls.sort(key=lambda c: c.attribute('LIKESCORE'), reverse=True)
for call in allcalls:
if call.attribute('LIKESCORE') < 0.0:
call.filter(kevlar.vcf.VariantFilter.LikelihoodFail)
yield call


Expand Down
2 changes: 1 addition & 1 deletion kevlar/tests/test_alac.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_pico_partitioned(capsys):

out, err = capsys.readouterr()
lines = out.strip().split('\n')
assert len(lines) == 33
assert len(lines) == 34
lines = [l for l in lines if not l.startswith('#')]
assert len(lines) == 10
numnocalls = sum([1 for line in lines if '\t.\t.\t.\t.\t' in line])
Expand Down
6 changes: 5 additions & 1 deletion kevlar/vcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class VariantFilter(Enum):
PassengerVariant = 3
MateFail = 4
PartitionScore = 5
LikelihoodFail = 6


class FormattedList(list):
Expand Down Expand Up @@ -233,7 +234,10 @@ class VCFWriter(object):
'call',
VariantFilter.PartitionScore:
'Expectation is 1 variant call per partition, so all call(s) with '
'suboptimal likelihood scores are filtered'
'suboptimal likelihood scores are filtered',
VariantFilter.LikelihoodFail:
'Variant calls with a likelihood score < 0.0 are unlikely to be'
'real',
}

info_metadata = {
Expand Down

0 comments on commit fe18a13

Please sign in to comment.