BaselineExperimentProfilesList extends GeneProfilesList<BaselineExperimentProfile> { public List<FactorAcrossExperiments> getFactorsAcrossExperiments() { TreeSet<FactorAcrossExperiments> result = new TreeSet<>(); for (BaselineExperimentProfile profile: this) { result.addAll(profile.getConditions()); } return ImmutableList.copyOf(result); } BaselineExperimentProfilesList(); List<FactorAcrossExperiments> getFactorsAcrossExperiments();  }
@Test public void testGetFactorsAcrossExperiments() { BaselineExperimentProfilesList result = new BaselineExperimentProfilesList(); BaselineExperimentProfile p1 = new BaselineExperimentProfile(MockExperiment.createBaselineExperiment(), new FactorSet()); p1.add(new FactorAcrossExperiments(new Factor(factorHeader, "v1")), new BaselineExpression(1.0)); p1.add(new FactorAcrossExperiments(new Factor(factorHeader, "v2")), new BaselineExpression(2.0)); result.add(p1); assertThat(result.getFactorsAcrossExperiments().size(), is(2)); BaselineExperimentProfile p2 = new BaselineExperimentProfile(MockExperiment.createBaselineExperiment(), new FactorSet()); p2.add(new FactorAcrossExperiments(new Factor(factorHeader, "v1")), new BaselineExpression(1.0)); p2.add(new FactorAcrossExperiments(new Factor(factorHeader, "v3")), new BaselineExpression(3.0)); result.add(p2); assertThat(result.getFactorsAcrossExperiments().size(), is(3)); }
@Test public void zerosDoMakeItToTheList() { BaselineExperimentProfilesList result = new BaselineExperimentProfilesList(); BaselineExperimentProfile p1 = new BaselineExperimentProfile(MockExperiment.createBaselineExperiment(), new FactorSet()); p1.add(new FactorAcrossExperiments(new Factor(factorHeader, "v1")), new BaselineExpression(1.0)); p1.add(new FactorAcrossExperiments(new Factor(factorHeader, "v2")), new BaselineExpression(2.0)); p1.add(new FactorAcrossExperiments(new Factor(factorHeader, "v3")), new BaselineExpression(0.0)); result.add(p1); assertThat(result.getFactorsAcrossExperiments().size(), is(3)); }