HiPhivePriority implements Prioritiser<HiPhivePriorityResult> { @Override public Stream<HiPhivePriorityResult> prioritise(List<String> hpoIds, List<Gene> genes) { if (options.isBenchmarkingEnabled()) { logger.debug("Running in benchmarking mode for disease: {} and candidateGene: {}", options.getDiseaseId(), options.getCandidateGeneSymbol()); } List<PhenotypeTerm> hpoPhenotypeTerms = priorityService.makePhenotypeTermsFromHpoIds(hpoIds); Set<Integer> wantedGeneIds = genes.stream().map(Gene::getEntrezGeneID).collect(ImmutableSet.toImmutableSet()); ListMultimap<Integer, GeneModelPhenotypeMatch> bestGeneModels = makeBestGeneModelsForOrganisms(hpoPhenotypeTerms, Organism.HUMAN, options .getOrganismsToRun(), wantedGeneIds); HiPhiveProteinInteractionScorer ppiScorer = makeHiPhiveProteinInteractionScorer(bestGeneModels, options.runPpi()); logger.debug("Prioritising genes..."); return genes.stream().map(makeHiPhivePriorityResult(hpoPhenotypeTerms, bestGeneModels, ppiScorer)); } HiPhivePriority(HiPhiveOptions options, DataMatrix randomWalkMatrix, PriorityService priorityService); @Override PriorityType getPriorityType(); @Override Stream<HiPhivePriorityResult> prioritise(List<String> hpoIds, List<Gene> genes); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testPrioritise() { HiPhivePriority instance = new HiPhivePriority(HiPhiveOptions.builder() .runParams("human,mouse,fish") .build(), DataMatrix.empty(), priorityService); List<Gene> genes = getGenes(); List<HiPhivePriorityResult> results = instance.prioritise(hpoIds, genes) .sorted(Comparator.naturalOrder()) .collect(toList()); assertThat(results.size(), equalTo(genes.size())); Map<String, List<Double>> geneScores = expectedHumanMouseFishScores(); results.forEach(checkScores(geneScores)); }
@Test public void testPrioritiseWithUnMappedQueryPhenotype() { List<String> hpoIds = getHpoIds(); hpoIds.add("HP:0000707"); HiPhivePriority instance = new HiPhivePriority(HiPhiveOptions.builder() .runParams("human,mouse,fish") .build(), DataMatrix.empty(), priorityService); List<Gene> genes = getGenes(); List<HiPhivePriorityResult> results = instance.prioritise(hpoIds, genes) .sorted(Comparator.naturalOrder()) .collect(toList()); assertThat(results.size(), equalTo(genes.size())); Map<String, List<Double>> expectedScores = new LinkedHashMap<>(); expectedScores.put("FGFR2", Lists.newArrayList(0.9442318091865164, 0.8394768488788327, 0.0, 0.0, 0.0)); expectedScores.put("ROR2", Lists.newArrayList(0.9091215195222582, 0.73554842149647, 0.0, 0.0, 0.0)); expectedScores.put("FREM2", Lists.newArrayList(0.6248281688059083016639761, 0.6436054831824984390209465, 0.0, 0.0, 0.0)); expectedScores.put("ZNF738", Lists.newArrayList(0.0, 0.0, 0.0, 0.0, 0.0)); results.forEach(checkScores(expectedScores)); }