BaselineExpressionPerBiologicalReplicate implements Expression { @Override public double getLevel() { return new Median().evaluate(expressionValuesSorted()); } BaselineExpressionPerBiologicalReplicate(Map<BiologicalReplicate, BaselineExpression> data); @Override double getLevel(); @Override JsonObject toJson(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); final Map<BiologicalReplicate, BaselineExpression> data; }
@Test public void expressionLevelIsTheMedian() { assertThat( new BaselineExpressionPerBiologicalReplicate( ImmutableMap.of( new BiologicalReplicate("assay_1"), new BaselineExpression(1.0))).getLevel(), is(1.0)); assertThat( new BaselineExpressionPerBiologicalReplicate( ImmutableMap.of( new BiologicalReplicate("assay_1"), new BaselineExpression(1.0), new BiologicalReplicate("assay_2"), new BaselineExpression(1.0))).getLevel(), is(1.0)); assertThat( new BaselineExpressionPerBiologicalReplicate( ImmutableMap.of( new BiologicalReplicate("assay_1"), new BaselineExpression(1.0), new BiologicalReplicate("assay_2"), new BaselineExpression(2.0))).getLevel(), is(1.5)); }