AnalysisStepChecker { public List<AnalysisStep> check(List<AnalysisStep> analysisSteps) { if (analysisSteps.size() < 2) { return analysisSteps; } moveInheritanceModeDependentStepsAfterLastVariantFilter(analysisSteps); removePriorityScoreFiltersWithoutMatchingPrioritiser(analysisSteps); movePriorityScoreFiltersNextToMatchingPrioritiser(analysisSteps); analysisSteps.sort(new AnalysisStepComparator()); return analysisSteps; }  List<AnalysisStep> check(List<AnalysisStep> analysisSteps);  }
@Test public void testCheckEmptyListIsUnchanged() { assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckOneStepIsUnchanged() { analysisSteps.add(KNOWN_VARIANT_FILTER); expectedSteps.add(KNOWN_VARIANT_FILTER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckTwoStepsInLegalOrderIsUnchanged() { analysisSteps.add(FREQUENCY_FILTER); analysisSteps.add(KNOWN_VARIANT_FILTER); expectedSteps.add(FREQUENCY_FILTER); expectedSteps.add(KNOWN_VARIANT_FILTER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckTwoVariantFilterStepsInIllegalOrderIsReordered() { analysisSteps.add(INHERITANCE_FILTER); analysisSteps.add(KNOWN_VARIANT_FILTER); expectedSteps.add(KNOWN_VARIANT_FILTER); expectedSteps.add(INHERITANCE_FILTER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckTwoVariantFilterStepsAndInheritanceFilterInLegalOrderIsUnchanged() { analysisSteps.add(KNOWN_VARIANT_FILTER); analysisSteps.add(FREQUENCY_FILTER); analysisSteps.add(INHERITANCE_FILTER); expectedSteps.add(KNOWN_VARIANT_FILTER); expectedSteps.add(FREQUENCY_FILTER); expectedSteps.add(INHERITANCE_FILTER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckTwoVariantFilterStepsAndInheritanceFilterInIllegalOrderIsReordered() { analysisSteps.add(INHERITANCE_FILTER); analysisSteps.add(KNOWN_VARIANT_FILTER); analysisSteps.add(FREQUENCY_FILTER); expectedSteps.add(KNOWN_VARIANT_FILTER); expectedSteps.add(FREQUENCY_FILTER); expectedSteps.add(INHERITANCE_FILTER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckTwoInheritanceModeDependentStepsInLegalOrderIsUnchanged() { analysisSteps.add(INHERITANCE_FILTER); analysisSteps.add(OMIM_PRIORITISER); expectedSteps.add(INHERITANCE_FILTER); expectedSteps.add(OMIM_PRIORITISER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckTwoInheritanceModeDependentStepsInIllegalOrderIsReordered() { analysisSteps.add(OMIM_PRIORITISER); analysisSteps.add(INHERITANCE_FILTER); expectedSteps.add(INHERITANCE_FILTER); expectedSteps.add(OMIM_PRIORITISER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckTwoInheritanceModeDependentStepsAndVariantFilterInIllegalOrderIsReordered() { analysisSteps.add(OMIM_PRIORITISER); analysisSteps.add(KNOWN_VARIANT_FILTER); analysisSteps.add(INHERITANCE_FILTER); expectedSteps.add(KNOWN_VARIANT_FILTER); expectedSteps.add(INHERITANCE_FILTER); expectedSteps.add(OMIM_PRIORITISER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckInheritanceModeDependentStepsRunAfterPrioritiserAndVariantFilter() { analysisSteps.add(OMIM_PRIORITISER); analysisSteps.add(PHIVE_PRIORITISER); analysisSteps.add(KNOWN_VARIANT_FILTER); analysisSteps.add(INHERITANCE_FILTER); expectedSteps.add(PHIVE_PRIORITISER); expectedSteps.add(KNOWN_VARIANT_FILTER); expectedSteps.add(INHERITANCE_FILTER); expectedSteps.add(OMIM_PRIORITISER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckTwoInheritanceModeDependentStepsAndTwoVariantFiltersInIllegalOrderIsReordered() { analysisSteps.add(OMIM_PRIORITISER); analysisSteps.add(FREQUENCY_FILTER); analysisSteps.add(KNOWN_VARIANT_FILTER); analysisSteps.add(INHERITANCE_FILTER); expectedSteps.add(FREQUENCY_FILTER); expectedSteps.add(KNOWN_VARIANT_FILTER); expectedSteps.add(INHERITANCE_FILTER); expectedSteps.add(OMIM_PRIORITISER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckTwoPrioritisersAndVariantFiltersInLegalOrderIsUnchanged() { analysisSteps.add(FREQUENCY_FILTER); analysisSteps.add(NONE_TYPE_PRIORITISER); analysisSteps.add(KNOWN_VARIANT_FILTER); analysisSteps.add(OMIM_PRIORITISER); expectedSteps.add(FREQUENCY_FILTER); expectedSteps.add(NONE_TYPE_PRIORITISER); expectedSteps.add(KNOWN_VARIANT_FILTER); expectedSteps.add(OMIM_PRIORITISER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckPrioritiserAndCorrectPriorityScoreFilterInLegalOrderIsUnchanged() { analysisSteps.add(NONE_TYPE_PRIORITISER); analysisSteps.add(NONE_TYPE_PRIORITY_SCORE_FILTER); expectedSteps.add(NONE_TYPE_PRIORITISER); expectedSteps.add(NONE_TYPE_PRIORITY_SCORE_FILTER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckPrioritiserAndCorrectPriorityScoreFilterInIllegalOrderIsReordered() { analysisSteps.add(NONE_TYPE_PRIORITY_SCORE_FILTER); analysisSteps.add(NONE_TYPE_PRIORITISER); expectedSteps.add(NONE_TYPE_PRIORITISER); expectedSteps.add(NONE_TYPE_PRIORITY_SCORE_FILTER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckTwoPrioritisersAndCorrectPriorityScoreFilterInLegalOrderIsUnchanged() { analysisSteps.add(NONE_TYPE_PRIORITISER); analysisSteps.add(NONE_TYPE_PRIORITY_SCORE_FILTER); analysisSteps.add(OMIM_PRIORITISER); expectedSteps.add(NONE_TYPE_PRIORITISER); expectedSteps.add(NONE_TYPE_PRIORITY_SCORE_FILTER); expectedSteps.add(OMIM_PRIORITISER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckPrioritisersAndInCorrectPriorityScoreFilterRemovesUnmatchedPriorityScoreFilter() { analysisSteps.add(PHIVE_PRIORITISER); analysisSteps.add(NONE_TYPE_PRIORITY_SCORE_FILTER); expectedSteps.add(PHIVE_PRIORITISER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckPrioritisersAndPriorityScoreFilterRemovesUnmatchedPriorityScoreFilter() { analysisSteps.add(PHIVE_PRIORITISER); analysisSteps.add(PHIVE_PRIORITY_SCORE_FILTER); analysisSteps.add(NONE_TYPE_PRIORITY_SCORE_FILTER); analysisSteps.add(OMIM_PRIORITISER); expectedSteps.add(PHIVE_PRIORITISER); expectedSteps.add(PHIVE_PRIORITY_SCORE_FILTER); expectedSteps.add(OMIM_PRIORITISER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckEverythingWrongGetsMadeRight() { analysisSteps.add(OMIM_PRIORITISER); analysisSteps.add(PHIVE_PRIORITISER); analysisSteps.add(FREQUENCY_FILTER); analysisSteps.add(PHIVE_PRIORITY_SCORE_FILTER); analysisSteps.add(INHERITANCE_FILTER); analysisSteps.add(NONE_TYPE_PRIORITY_SCORE_FILTER); analysisSteps.add(OMIM_PRIORITY_SCORE_FILTER); analysisSteps.add(KNOWN_VARIANT_FILTER); expectedSteps.add(PHIVE_PRIORITISER); expectedSteps.add(PHIVE_PRIORITY_SCORE_FILTER); expectedSteps.add(FREQUENCY_FILTER); expectedSteps.add(KNOWN_VARIANT_FILTER); expectedSteps.add(INHERITANCE_FILTER); expectedSteps.add(OMIM_PRIORITISER); expectedSteps.add(OMIM_PRIORITY_SCORE_FILTER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckEverythingWrongGetsMadeRightMoreInsanity() { analysisSteps.add(INHERITANCE_FILTER); analysisSteps.add(PHIVE_PRIORITISER); analysisSteps.add(OMIM_PRIORITISER); analysisSteps.add(FREQUENCY_FILTER); analysisSteps.add(NONE_TYPE_PRIORITY_SCORE_FILTER); analysisSteps.add(PHIVE_PRIORITY_SCORE_FILTER); analysisSteps.add(KNOWN_VARIANT_FILTER); analysisSteps.add(OMIM_PRIORITY_SCORE_FILTER); expectedSteps.add(PHIVE_PRIORITISER); expectedSteps.add(PHIVE_PRIORITY_SCORE_FILTER); expectedSteps.add(FREQUENCY_FILTER); expectedSteps.add(KNOWN_VARIANT_FILTER); expectedSteps.add(INHERITANCE_FILTER); expectedSteps.add(OMIM_PRIORITISER); expectedSteps.add(OMIM_PRIORITY_SCORE_FILTER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckEverythingWrongGetsMadeRightIdiocyStrikesAgain() { analysisSteps.add(OMIM_PRIORITY_SCORE_FILTER); analysisSteps.add(OMIM_PRIORITISER); analysisSteps.add(INHERITANCE_FILTER); analysisSteps.add(PHIVE_PRIORITISER); analysisSteps.add(KNOWN_VARIANT_FILTER); analysisSteps.add(FREQUENCY_FILTER); analysisSteps.add(NONE_TYPE_PRIORITY_SCORE_FILTER); analysisSteps.add(PHIVE_PRIORITY_SCORE_FILTER); expectedSteps.add(PHIVE_PRIORITISER); expectedSteps.add(PHIVE_PRIORITY_SCORE_FILTER); expectedSteps.add(KNOWN_VARIANT_FILTER); expectedSteps.add(FREQUENCY_FILTER); expectedSteps.add(INHERITANCE_FILTER); expectedSteps.add(OMIM_PRIORITISER); expectedSteps.add(OMIM_PRIORITY_SCORE_FILTER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckOriginalExomiserAlgorithmIsntChanged() { analysisSteps.add(KNOWN_VARIANT_FILTER); analysisSteps.add(FREQUENCY_FILTER); analysisSteps.add(INHERITANCE_FILTER); analysisSteps.add(OMIM_PRIORITISER); analysisSteps.add(PHIVE_PRIORITISER); expectedSteps.add(KNOWN_VARIANT_FILTER); expectedSteps.add(FREQUENCY_FILTER); expectedSteps.add(INHERITANCE_FILTER); expectedSteps.add(OMIM_PRIORITISER); expectedSteps.add(PHIVE_PRIORITISER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckGenomiserAlgorithmIsntChanged() { analysisSteps.add(PHIVE_PRIORITISER); analysisSteps.add(PHIVE_PRIORITY_SCORE_FILTER); analysisSteps.add(KNOWN_VARIANT_FILTER); analysisSteps.add(FREQUENCY_FILTER); analysisSteps.add(INHERITANCE_FILTER); analysisSteps.add(OMIM_PRIORITISER); expectedSteps.add(PHIVE_PRIORITISER); expectedSteps.add(PHIVE_PRIORITY_SCORE_FILTER); expectedSteps.add(KNOWN_VARIANT_FILTER); expectedSteps.add(FREQUENCY_FILTER); expectedSteps.add(INHERITANCE_FILTER); expectedSteps.add(OMIM_PRIORITISER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }
@Test public void testCheckSlightlyOddYetNotIncorrectSetupIsntChanged() { analysisSteps.add(KNOWN_VARIANT_FILTER); analysisSteps.add(PHIVE_PRIORITISER); analysisSteps.add(PHIVE_PRIORITY_SCORE_FILTER); analysisSteps.add(FREQUENCY_FILTER); analysisSteps.add(INHERITANCE_FILTER); analysisSteps.add(OMIM_PRIORITISER); expectedSteps.add(KNOWN_VARIANT_FILTER); expectedSteps.add(PHIVE_PRIORITISER); expectedSteps.add(PHIVE_PRIORITY_SCORE_FILTER); expectedSteps.add(FREQUENCY_FILTER); expectedSteps.add(INHERITANCE_FILTER); expectedSteps.add(OMIM_PRIORITISER); assertThat(instance.check(analysisSteps), equalTo(expectedSteps)); }