PathogenicityFilter implements VariantFilter { @Override public FilterResult runFilter(VariantEvaluation variantEvaluation) { if (keepNonPathogenic) { return PASS; } if (variantEvaluation.isPredictedPathogenic()) { return PASS; } return FAIL; } PathogenicityFilter(boolean keepNonPathogenic); @JsonProperty boolean keepNonPathogenic(); @Override FilterType getFilterType(); @Override FilterResult runFilter(VariantEvaluation variantEvaluation); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testThatOffTargetNonPathogenicVariantsAreStillScoredAndFailFilterWhenPassAllVariantsSetFalse() { instance = new PathogenicityFilter(PASS_ONLY_PATHOGENIC_AND_MISSENSE_VARIANTS); FilterResult filterResult = instance.runFilter(downstreamFailsFilter); FilterTestHelper.assertFailed(filterResult); }
@Test public void testThatOffTargetNonPathogenicVariantsAreStillScoredAndPassFilterWhenPassAllVariantsSetTrue() { instance = new PathogenicityFilter(PASS_ALL_VARIANTS); FilterResult filterResult = instance.runFilter(downstreamFailsFilter); FilterTestHelper.assertPassed(filterResult); }
@Test public void testThatMissenseNonPathogenicVariantsAreStillScoredAndPassFilterWhenPassAllVariantsSetTrue() { instance = new PathogenicityFilter(PASS_ALL_VARIANTS); FilterResult filterResult = instance.runFilter(predictedNonPathogenicMissense); FilterTestHelper.assertPassed(filterResult); }
@Test public void testThatMissenseNonPathogenicVariantsAreStillScoredAndPassFilterWhenPassAllVariantsSetFalse() { instance = new PathogenicityFilter(PASS_ONLY_PATHOGENIC_AND_MISSENSE_VARIANTS); FilterResult filterResult = instance.runFilter(predictedNonPathogenicMissense); FilterTestHelper.assertPassed(filterResult); }
@Test void alwaysPassesWhiteListedVariant() { instance = new PathogenicityFilter(PASS_ONLY_PATHOGENIC_AND_MISSENSE_VARIANTS); FilterTestHelper.assertFailed(instance.runFilter(downstreamFailsFilter)); downstreamFailsFilter.setWhiteListed(true); FilterTestHelper.assertPassed(instance.runFilter(downstreamFailsFilter)); }