PriorityScoreFilter implements GeneFilter { @Override public FilterResult runFilter(Gene gene) { PriorityResult priorityResult = gene.getPriorityResult(priorityType); if (priorityResult == null) { return FAIL; } if (priorityResult.getScore() >= minPriorityScore) { return addFilterResultToVariants(PASS, gene); } return addFilterResultToVariants(FAIL, gene); } PriorityScoreFilter(PriorityType priorityType, float minPriorityScore); PriorityType getPriorityType(); float getMinPriorityScore(); @Override FilterType getFilterType(); @Override FilterResult runFilter(Gene gene); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testRunFilterFailsGeneWithWrongPriorityTypeScoreSameAsThreshold() { PriorityResult priorityResult = new MockPriorityResult(PriorityType.OMIM_PRIORITY, gene.getEntrezGeneID(), gene.getGeneSymbol(), minPriorityScore); gene.addPriorityResult(priorityResult); FilterResult result = instance.runFilter(gene); assertFails(result); }
@Test public void testRunFilterPassesGeneWithCorrectPriorityTypeScoreSameAsThreshold() { PriorityResult priorityResult = makeDefaultPriorityResult(minPriorityScore); gene.addPriorityResult(priorityResult); FilterResult result = instance.runFilter(gene); assertPasses(result); }
@Test public void testRunFilterPassesGeneWithCorrectPriorityTypeScoreOverThreshold() { PriorityResult priorityResult = makeDefaultPriorityResult(minPriorityScore + 0.2f); gene.addPriorityResult(priorityResult); FilterResult result = instance.runFilter(gene); assertPasses(result); }
@Test public void testRunFilterFailsGeneWithCorrectPriorityTypeScoreUnderThreshold() { PriorityResult priorityResult = makeDefaultPriorityResult(minPriorityScore - 0.2f); gene.addPriorityResult(priorityResult); FilterResult result = instance.runFilter(gene); assertFails(result); }
@Test public void testRunFilterVariantInFailedGeneAlsoFailsTheFilter() { PriorityResult priorityResult = makeDefaultPriorityResult(minPriorityScore - 0.2f); gene.addPriorityResult(priorityResult); VariantEvaluation variant = VariantEvaluation.builder(1, 1, "A", "T").build(); gene.addVariant(variant); FilterResult result = instance.runFilter(gene); assertFails(result); assertThat(variant.passedFilter(FilterType.PRIORITY_SCORE_FILTER), is(false)); assertThat(variant.getFailedFilterTypes(), hasItem(FilterType.PRIORITY_SCORE_FILTER)); }
@Test public void testRunFilterFailsGeneWithNoSetPriorityScore() { FilterResult result = instance.runFilter(gene); assertFails(result); }