@Test public void getScoreWithNonInformativeFeaturesReturns0() throws ComponentLookupException { VocabularyTerm hp10 = mock(VocabularyTerm.class); VocabularyTerm hp11 = mock(VocabularyTerm.class); VocabularyTerm hp12 = mock(VocabularyTerm.class); VocabularyTerm hp13 = mock(VocabularyTerm.class); VocabularyTerm hp14 = mock(VocabularyTerm.class); VocabularyTerm hp15 = mock(VocabularyTerm.class); when(this.hpo.getTerm("HP:10")).thenReturn(hp10); when(this.hpo.getTerm("HP:11")).thenReturn(hp11); when(this.hpo.getTerm("HP:12")).thenReturn(hp12); when(this.hpo.getTerm("HP:13")).thenReturn(hp13); when(this.hpo.getTerm("HP:14")).thenReturn(hp14); when(this.hpo.getTerm("HP:15")).thenReturn(hp15); when(hp10.getId()).thenReturn("HP:10"); when(hp11.getId()).thenReturn("HP:11"); when(hp12.getId()).thenReturn("HP:12"); when(hp13.getId()).thenReturn("HP:13"); when(hp14.getId()).thenReturn("HP:14"); when(hp15.getId()).thenReturn("HP:15"); when(hp10.getParents()).thenReturn(Collections.singleton(hp11)); when(hp11.getParents()).thenReturn(Collections.singleton(hp12)); when(hp12.getParents()).thenReturn(Collections.singleton(hp13)); when(hp13.getParents()).thenReturn(Collections.singleton(hp14)); when(hp14.getParents()).thenReturn(Collections.singleton(hp15)); when(this.omim.count(Collections.singletonMap("symptom", "HP:10"))).thenReturn(0L); when(this.omim.count(Collections.singletonMap("symptom", "HP:11"))).thenReturn(0L); when(this.omim.count(Collections.singletonMap("symptom", "HP:12"))).thenReturn(0L); when(this.omim.count(Collections.singletonMap("symptom", "HP:13"))).thenReturn(0L); when(this.omim.count(Collections.singletonMap("symptom", "HP:14"))).thenReturn(0L); when(this.omim.count(Collections.singletonMap("symptom", "HP:15"))).thenReturn(0L); Feature feature = mock(Feature.class); when(feature.getId()).thenReturn("HP:10"); when(feature.isPresent()).thenReturn(true); Mockito.doReturn(Collections.singleton(feature)).when(this.patient).getFeatures(); Assert.assertEquals(0.0, this.mocker.getComponentUnderTest().getScore(this.patient), 0.0); }
@Override public double getScore(Patient patient) { Pair<Double, Integer> symptomsScore = process(patient, true); Pair<Double, Integer> negativeSymptomsScore = process(patient, false); double score = 0; if (symptomsScore.getRight() + negativeSymptomsScore.getRight() > 0) { score = 2 * Math.atan(symptomsScore.getLeft() / 10 + negativeSymptomsScore.getLeft() / 20) / Math.PI; } return score; }
OmimInformationContentPatientScorer implements PatientScorer, Initializable { @Override public double getScore(Patient patient) { Pair<Double, Integer> symptomsScore = process(patient, true); Pair<Double, Integer> negativeSymptomsScore = process(patient, false); double score = 0; if (symptomsScore.getRight() + negativeSymptomsScore.getRight() > 0) { score = 2 * Math.atan(symptomsScore.getLeft() / 10 + negativeSymptomsScore.getLeft() / 20) / Math.PI; } return score; } }
OmimInformationContentPatientScorer implements PatientScorer, Initializable { @Override public double getScore(Patient patient) { Pair<Double, Integer> symptomsScore = process(patient, true); Pair<Double, Integer> negativeSymptomsScore = process(patient, false); double score = 0; if (symptomsScore.getRight() + negativeSymptomsScore.getRight() > 0) { score = 2 * Math.atan(symptomsScore.getLeft() / 10 + negativeSymptomsScore.getLeft() / 20) / Math.PI; } return score; }  }
OmimInformationContentPatientScorer implements PatientScorer, Initializable { @Override public double getScore(Patient patient) { Pair<Double, Integer> symptomsScore = process(patient, true); Pair<Double, Integer> negativeSymptomsScore = process(patient, false); double score = 0; if (symptomsScore.getRight() + negativeSymptomsScore.getRight() > 0) { score = 2 * Math.atan(symptomsScore.getLeft() / 10 + negativeSymptomsScore.getLeft() / 20) / Math.PI; } return score; }  @Override void initialize(); @Override PatientSpecificity getSpecificity(Patient patient); @Override double getScore(Patient patient); }
OmimInformationContentPatientScorer implements PatientScorer, Initializable { @Override public double getScore(Patient patient) { Pair<Double, Integer> symptomsScore = process(patient, true); Pair<Double, Integer> negativeSymptomsScore = process(patient, false); double score = 0; if (symptomsScore.getRight() + negativeSymptomsScore.getRight() > 0) { score = 2 * Math.atan(symptomsScore.getLeft() / 10 + negativeSymptomsScore.getLeft() / 20) / Math.PI; } return score; }  @Override void initialize(); @Override PatientSpecificity getSpecificity(Patient patient); @Override double getScore(Patient patient);  }