GenePriorityScoreCalculator { double calculateGenePriorityScoreForMode(Gene gene, ModeOfInheritance modeOfInheritance) { double phenotypePrioritiserScore = gene.getPriorityResults().values().stream() .filter(isNonOmimPriorityResult()) .findFirst() .orElseGet(ZeroScorePrioritserResult::new) .getScore(); Map<ModeOfInheritance, Double> diseaseScoresByMode = getOmimPriorityResultScoresOrEmpty(gene); double knownDiseaseInheritanceModeModifier = diseaseScoresByMode.getOrDefault(modeOfInheritance, 1d); return phenotypePrioritiserScore * knownDiseaseInheritanceModeModifier; }    }
@Test public void emptyGeneWithAnyInheritance() { Gene empty = newGene(); double score = instance.calculateGenePriorityScoreForMode(empty, ModeOfInheritance.ANY); assertThat(score, equalTo(0d)); }
@Test public void prioritisedGeneWithAnyInheritance() { Gene gene = newGene(); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.ANY); assertThat(score, equalTo(PHENOTYPE_SCORE)); }
@Test public void omimPrioritisedOnlyGeneWithKnownDiseaseCurrentInheritanceMatchesOneDiseaseInheritance() { Gene gene = newGeneCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT); InheritanceMode[] inheritanceModes = {InheritanceMode.AUTOSOMAL_RECESSIVE, InheritanceMode.AUTOSOMAL_DOMINANT}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); scores.put(ModeOfInheritance.AUTOSOMAL_DOMINANT, 1.0); scores.put(ModeOfInheritance.AUTOSOMAL_RECESSIVE, 1.0); scores.put(ModeOfInheritance.X_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_DOMINANT, 0.5); scores.put(ModeOfInheritance.MITOCHONDRIAL, 0.5); addOmimResultToGene(gene, scores, inheritanceModes); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.AUTOSOMAL_DOMINANT); assertThat(score, equalTo(0.0)); }
@Test public void prioritisedGeneWithNoKnownDiseasesAnyInheritance() { Gene gene = newGene(); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {}; addOmimResultToGene(gene, Collections.emptyMap(), inheritanceModes); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.ANY); assertThat(score, equalTo(PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithNoKnownDiseasesIncompatibleWithCurrentInheritance() { Gene gene = newGeneCompatibleWith(ModeOfInheritance.AUTOSOMAL_RECESSIVE); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); scores.put(ModeOfInheritance.AUTOSOMAL_DOMINANT, 0.5); scores.put(ModeOfInheritance.AUTOSOMAL_RECESSIVE, 1.0); scores.put(ModeOfInheritance.X_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_DOMINANT, 0.5); scores.put(ModeOfInheritance.MITOCHONDRIAL, 0.5); addOmimResultToGene(gene, scores, inheritanceModes); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.AUTOSOMAL_DOMINANT); assertThat(score, equalTo(0.5 * PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithNoOmimPrioritiserCompatibleWithCurrentInheritance() { Gene gene = newGeneCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.AUTOSOMAL_DOMINANT); assertThat(score, equalTo(PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithKnownDiseasesUnknownInheritance() { Gene gene = newGene(); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {InheritanceMode.UNKNOWN}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); addOmimResultToGene(gene, scores, inheritanceModes); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.AUTOSOMAL_DOMINANT); assertThat(score, equalTo(PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithKnownDiseasesAnyInheritance() { Gene gene = newGene(); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {InheritanceMode.AUTOSOMAL_DOMINANT}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); addOmimResultToGene(gene, scores, inheritanceModes); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.ANY); assertThat(score, equalTo(PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithInheritanceModesKnownDiseasesUnknownInheritance() { Gene gene = newGeneCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {InheritanceMode.UNKNOWN}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); scores.put(ModeOfInheritance.AUTOSOMAL_DOMINANT, 1.0); scores.put(ModeOfInheritance.AUTOSOMAL_RECESSIVE, 1.0); scores.put(ModeOfInheritance.X_RECESSIVE, 1.0); scores.put(ModeOfInheritance.X_DOMINANT, 1.0); scores.put(ModeOfInheritance.MITOCHONDRIAL, 1.0); addOmimResultToGene(gene, scores, inheritanceModes); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.AUTOSOMAL_DOMINANT); assertThat(score, equalTo(PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithKnownDiseaseCurrentInheritanceMatchesDiseaseAndGeneInheritance() { Gene gene = newGeneCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {InheritanceMode.AUTOSOMAL_DOMINANT}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); scores.put(ModeOfInheritance.AUTOSOMAL_DOMINANT, 1.0); scores.put(ModeOfInheritance.AUTOSOMAL_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_DOMINANT, 0.5); scores.put(ModeOfInheritance.MITOCHONDRIAL, 0.5); addOmimResultToGene(gene, scores, inheritanceModes); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.AUTOSOMAL_DOMINANT); assertThat(score, equalTo(PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithKnownDiseaseCurrentInheritanceNotMatchesGeneInheritance() { Gene gene = newGeneCompatibleWith(ModeOfInheritance.AUTOSOMAL_RECESSIVE); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {InheritanceMode.AUTOSOMAL_DOMINANT}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); scores.put(ModeOfInheritance.AUTOSOMAL_DOMINANT, 0.5); scores.put(ModeOfInheritance.AUTOSOMAL_RECESSIVE, 1.0); scores.put(ModeOfInheritance.X_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_DOMINANT, 0.5); scores.put(ModeOfInheritance.MITOCHONDRIAL, 0.5); addOmimResultToGene(gene, scores, inheritanceModes); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.AUTOSOMAL_DOMINANT); assertThat(score, equalTo(0.5 * PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithKnownDiseaseCurrentInheritanceNotMatchesDiseaseInheritance() { Gene gene = newGeneCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {InheritanceMode.AUTOSOMAL_RECESSIVE}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); scores.put(ModeOfInheritance.AUTOSOMAL_DOMINANT, 0.5); scores.put(ModeOfInheritance.AUTOSOMAL_RECESSIVE, 1.0); scores.put(ModeOfInheritance.X_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_DOMINANT, 0.5); scores.put(ModeOfInheritance.MITOCHONDRIAL, 0.5); addOmimResultToGene(gene, scores, inheritanceModes); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.AUTOSOMAL_DOMINANT); assertThat(score, equalTo(0.5 * PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithKnownDiseaseCurrentInheritanceMatchesOneDiseaseInheritance() { Gene gene = newGeneCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {InheritanceMode.AUTOSOMAL_DOMINANT, InheritanceMode.AUTOSOMAL_RECESSIVE}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); scores.put(ModeOfInheritance.AUTOSOMAL_DOMINANT, 1.0); scores.put(ModeOfInheritance.AUTOSOMAL_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_DOMINANT, 0.5); scores.put(ModeOfInheritance.MITOCHONDRIAL, 0.5); addOmimResultToGene(gene, scores, inheritanceModes); double adScore = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.AUTOSOMAL_DOMINANT); assertThat(adScore, equalTo(PHENOTYPE_SCORE)); double arScore = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.AUTOSOMAL_RECESSIVE); assertThat(arScore, equalTo(0.5 * PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithKnownDiseaseCurrentInheritanceNotMatchesDiseaseWithUnknownGeneInheritance() { Gene gene = newGeneCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT, ModeOfInheritance.AUTOSOMAL_RECESSIVE); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {InheritanceMode.AUTOSOMAL_RECESSIVE, InheritanceMode.UNKNOWN}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); scores.put(ModeOfInheritance.AUTOSOMAL_DOMINANT, 0.5); scores.put(ModeOfInheritance.AUTOSOMAL_RECESSIVE, 1.0); scores.put(ModeOfInheritance.X_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_DOMINANT, 0.5); scores.put(ModeOfInheritance.MITOCHONDRIAL, 0.5); addOmimResultToGene(gene, scores, inheritanceModes); double adScore = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.AUTOSOMAL_DOMINANT); assertThat(adScore, equalTo(0.5 * PHENOTYPE_SCORE)); double arScore = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.AUTOSOMAL_RECESSIVE); assertThat(arScore, equalTo(PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithKnownDiseasePolygenicInheritance() { Gene gene = newGeneCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {InheritanceMode.POLYGENIC}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); scores.put(ModeOfInheritance.AUTOSOMAL_DOMINANT, 0.5); scores.put(ModeOfInheritance.AUTOSOMAL_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_DOMINANT, 0.5); scores.put(ModeOfInheritance.MITOCHONDRIAL, 0.5); addOmimResultToGene(gene, scores, inheritanceModes); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.AUTOSOMAL_DOMINANT); assertThat(score, equalTo(0.5 * PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithKnownDiseaseSomaticInheritance() { Gene gene = newGeneCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {InheritanceMode.SOMATIC}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); scores.put(ModeOfInheritance.AUTOSOMAL_DOMINANT, 0.5); scores.put(ModeOfInheritance.AUTOSOMAL_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_DOMINANT, 0.5); scores.put(ModeOfInheritance.MITOCHONDRIAL, 0.5); addOmimResultToGene(gene, scores, inheritanceModes); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.AUTOSOMAL_DOMINANT); assertThat(score, equalTo(0.5 * PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithKnownDiseaseYlinkedInheritance() { Gene gene = newGeneCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {InheritanceMode.Y_LINKED}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); scores.put(ModeOfInheritance.AUTOSOMAL_DOMINANT, 1.0); scores.put(ModeOfInheritance.AUTOSOMAL_RECESSIVE, 1.0); scores.put(ModeOfInheritance.X_RECESSIVE, 1.0); scores.put(ModeOfInheritance.X_DOMINANT, 1.0); scores.put(ModeOfInheritance.MITOCHONDRIAL, 1.0); addOmimResultToGene(gene, scores, inheritanceModes); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.AUTOSOMAL_DOMINANT); assertThat(score, equalTo(PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithKnownDiseaseMitochondrialInheritance() { Gene gene = newGeneCompatibleWith(ModeOfInheritance.MITOCHONDRIAL); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {InheritanceMode.MITOCHONDRIAL}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); scores.put(ModeOfInheritance.AUTOSOMAL_DOMINANT, 0.5); scores.put(ModeOfInheritance.AUTOSOMAL_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_DOMINANT, 0.5); scores.put(ModeOfInheritance.MITOCHONDRIAL, 1.0); addOmimResultToGene(gene, scores, inheritanceModes); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.MITOCHONDRIAL); assertThat(score, equalTo(PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithKnownDiseaseAdAndArInheritance() { Gene gene = newGeneCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {InheritanceMode.AUTOSOMAL_DOMINANT_AND_RECESSIVE}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); scores.put(ModeOfInheritance.AUTOSOMAL_DOMINANT, 1.0); scores.put(ModeOfInheritance.AUTOSOMAL_RECESSIVE, 1.0); scores.put(ModeOfInheritance.X_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_DOMINANT, 0.5); scores.put(ModeOfInheritance.MITOCHONDRIAL, 0.5); addOmimResultToGene(gene, scores, inheritanceModes); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.AUTOSOMAL_DOMINANT); assertThat(score, equalTo(PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithKnownDiseaseXlinkedInheritance() { Gene gene = newGeneCompatibleWith(ModeOfInheritance.X_DOMINANT); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {InheritanceMode.X_LINKED}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); scores.put(ModeOfInheritance.AUTOSOMAL_DOMINANT, 0.5); scores.put(ModeOfInheritance.AUTOSOMAL_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_RECESSIVE, 1.0); scores.put(ModeOfInheritance.X_DOMINANT, 1.0); scores.put(ModeOfInheritance.MITOCHONDRIAL, 0.5); addOmimResultToGene(gene, scores, inheritanceModes); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.X_DOMINANT); assertThat(score, equalTo(PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithKnownDiseaseXlinkedDominantInheritance() { Gene gene = newGeneCompatibleWith(ModeOfInheritance.X_DOMINANT); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {InheritanceMode.X_DOMINANT}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); scores.put(ModeOfInheritance.AUTOSOMAL_DOMINANT, 0.5); scores.put(ModeOfInheritance.AUTOSOMAL_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_DOMINANT, 1.0); scores.put(ModeOfInheritance.MITOCHONDRIAL, 0.5); addOmimResultToGene(gene, scores, inheritanceModes); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.X_DOMINANT); assertThat(score, equalTo(PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithKnownDiseaseXlinkedRecessiveInheritance() { Gene gene = newGeneCompatibleWith(ModeOfInheritance.X_RECESSIVE); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {InheritanceMode.X_RECESSIVE}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); scores.put(ModeOfInheritance.AUTOSOMAL_DOMINANT, 0.5); scores.put(ModeOfInheritance.AUTOSOMAL_RECESSIVE, 0.5); scores.put(ModeOfInheritance.X_RECESSIVE, 1.0); scores.put(ModeOfInheritance.X_DOMINANT, 0.5); scores.put(ModeOfInheritance.MITOCHONDRIAL, 0.5); addOmimResultToGene(gene, scores, inheritanceModes); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.X_RECESSIVE); assertThat(score, equalTo(PHENOTYPE_SCORE)); }
@Test public void prioritisedGeneWithKnownDiseaseNoInheritanceModes() { Gene gene = newGeneCompatibleWith(ModeOfInheritance.X_RECESSIVE); addHiPhiveResultWithScore(gene, PHENOTYPE_SCORE); InheritanceMode[] inheritanceModes = {InheritanceMode.UNKNOWN}; Map<ModeOfInheritance, Double> scores = new EnumMap<>(ModeOfInheritance.class); addOmimResultToGene(gene, scores, inheritanceModes); double score = instance.calculateGenePriorityScoreForMode(gene, ModeOfInheritance.X_RECESSIVE); assertThat(score, equalTo(PHENOTYPE_SCORE)); }