DifferentialProfile extends Profile<Contrast, T, Self> { public long getSpecificity(final Regulation regulation) { return expressionsByCondition.values().stream() .filter(expr -> expr.getLevel() != 0 && expr.isRegulatedLike(regulation)) .count(); } DifferentialProfile(String geneId, String geneName); long getSpecificity(final Regulation regulation); double getAveragePValueOn(Collection<Contrast> contrasts);  }
@Test public void addingAnOverExpressedExpressionShouldUpdateMinAndMaxUpRegulatedLevelsAndSpecificity() { DifferentialExpression differentialExpressionMock1 = new DifferentialExpression(0.05, 0.4D); DifferentialExpression differentialExpressionMock2 = new DifferentialExpression(0.05, 0.6D); subject.add(fakeContrasts.get(0), differentialExpressionMock1); subject.add(fakeContrasts.get(1), differentialExpressionMock2); assertThat(subject.getSpecificity(Regulation.UP), is(2L)); assertThat(subject.getSpecificity(Regulation.UP_DOWN), is(2L)); assertThat(subject.getSpecificity(Regulation.DOWN), is(0L)); }
@Test public void addingUnderExpressedExpressionsShouldUpdateMinAndMaxDownRegulatedLevelsAndSpecificity() { DifferentialExpression differentialExpressionMock1 = new DifferentialExpression(0.05, -0.3D); DifferentialExpression differentialExpressionMock2 = new DifferentialExpression(0.05, -0.5D); subject.add(fakeContrasts.get(0), differentialExpressionMock1); subject.add(fakeContrasts.get(1), differentialExpressionMock2); assertThat(subject.getSpecificity(Regulation.DOWN), is(2L)); assertThat(subject.getSpecificity(Regulation.UP_DOWN), is(2L)); assertThat(subject.getSpecificity(Regulation.UP), is(0L)); }