Exemple #1
0
  @Test
  public void foldUnknownExpressionIsUnknownExpression() {
    BaselineProfile profileWithUnknownExpression = buildProfileWithUnknownExpression();

    BaselineProfile sumProfile = profileWithUnknownExpression.foldProfile(3);
    assertThat(sumProfile.getExpression(factor1).isKnown(), is(false));
  }
Exemple #2
0
 private BaselineProfile buildProfileWithUnknownExpression() {
   BaselineExpression unknownExpression1 =
       new BaselineExpression("NT", new FactorSet().add(factor1));
   BaselineProfile profileWithUnknownExpression = new BaselineProfile("OTHER_ID", "OTHER_NAME");
   profileWithUnknownExpression.add(QUERY_FACTOR_TYPE, unknownExpression1);
   return profileWithUnknownExpression;
 }
Exemple #3
0
 @Test
 public void testSumProfile() {
   subject.sumProfile(buildOtherProfile());
   assertThat(subject.getId(), is(subject.getId()));
   assertThat(subject.getKnownExpressionLevel(factor1), is(2.2D + 1D));
   assertThat(subject.getKnownExpressionLevel(factor2), is(3D + 2D));
   assertThat(subject.getKnownExpressionLevel(factor3), is(3.001D + 3D));
   assertThat(subject.getKnownExpressionLevel(factor4), is(300D));
 }
Exemple #4
0
  @Test
  public void nonTissueExpressionsDoNotAffectMinOrMax() {
    assertThat(subject.getMinExpressionLevel(), is(2.2));
    assertThat(subject.getMaxExpressionLevel(), is(3.001));

    subject.add(QUERY_FACTOR_TYPE, new BaselineExpression("NT", new FactorSet().add(factor1)));

    assertThat(subject.getMinExpressionLevel(), is(2.2));
    assertThat(subject.getMaxExpressionLevel(), is(3.001));
  }
Exemple #5
0
  @Test
  public void averageExpressionLevel() {
    double averageExpressionLevel =
        subject.getAverageExpressionLevelOn(Sets.newHashSet(factor1, factor3));
    assertThat(averageExpressionLevel, is(2.6005000000000003D));

    averageExpressionLevel =
        subject.getAverageExpressionLevelOn(
            Sets.newHashSet(factor1, factor3, new Factor(QUERY_FACTOR_TYPE, "leg")));
    assertThat(averageExpressionLevel, is(1.733666666666667D));
  }
Exemple #6
0
  @Test
  public void sumOfUnknownExpressionAndKnownExpressionIsUnknownExpression() {

    BaselineProfile profileWithUnknownExpression = buildProfileWithUnknownExpression();

    assertThat(subject.getExpression(factor1).isKnown(), is(true));
    assertThat(subject.getExpression(factor2).isKnown(), is(true));
    subject.sumProfile(profileWithUnknownExpression);
    assertThat(subject.getExpression(factor1).isKnown(), is(false));
    assertThat(subject.getExpression(factor2).isKnown(), is(true));
  }
Exemple #7
0
  BaselineProfile buildOtherProfile() {
    BaselineExpression expression_1 = new BaselineExpression(1D, new FactorSet().add(factor1));
    BaselineExpression expression_2 = new BaselineExpression(2D, new FactorSet().add(factor2));
    BaselineExpression expression_3 = new BaselineExpression(3D, new FactorSet().add(factor3));
    BaselineExpression expression_4 = new BaselineExpression(300D, new FactorSet().add(factor4));

    BaselineProfile baselineProfile = new BaselineProfile("OTHER_ID", "OTHER_NAME");

    return baselineProfile
        .add(QUERY_FACTOR_TYPE, expression_1)
        .add(QUERY_FACTOR_TYPE, expression_2)
        .add(QUERY_FACTOR_TYPE, expression_3)
        .add(QUERY_FACTOR_TYPE, expression_4);
  }
Exemple #8
0
 @Before
 public void setUp() throws Exception {
   subject = new BaselineProfile(GENE_ID, GENE_NAME);
   subject
       .add(QUERY_FACTOR_TYPE, expression_1)
       .add(QUERY_FACTOR_TYPE, expression_2)
       .add(QUERY_FACTOR_TYPE, expression_3);
 }
Exemple #9
0
 @Test
 public void averageExpressionLevelOnEmptyCollection() {
   // given
   Set<Factor> queryFactors = Sets.newHashSet(mock(Factor.class));
   // when
   double averageExpressionLevel = subject.getAverageExpressionLevelOn(queryFactors);
   // then
   assertThat(averageExpressionLevel, is(0D));
 }
Exemple #10
0
  @Test
  public void sumProfileShouldPreserveLevelsThatAreNotExpressedInOtherProfile() {
    BaselineProfile otherProfile =
        new BaselineProfile("other profile", "other name").add(QUERY_FACTOR_TYPE, expression_2);

    subject.sumProfile(otherProfile);
    assertThat(subject.getId(), is(GENE_ID));
    assertThat(
        subject.getKnownExpressionLevel(factor1), is(subject.getKnownExpressionLevel(factor1)));
    assertThat(subject.getKnownExpressionLevel(factor2), is(6D));
    assertThat(
        subject.getKnownExpressionLevel(factor3), is(subject.getKnownExpressionLevel(factor3)));
    assertThat(subject.getKnownExpressionLevel(factor4), is(nullValue()));
  }
Exemple #11
0
 @Test
 public void testFold() {
   BaselineProfile sumProfile = subject.foldProfile(3);
   assertThat(sumProfile.getId(), is(subject.getId()));
   assertThat(sumProfile.getKnownExpressionLevel(factor1), is(0.7D));
   assertThat(sumProfile.getKnownExpressionLevel(factor2), is(1.0D));
   assertThat(sumProfile.getKnownExpressionLevel(factor3), is(1.0D));
   assertThat(sumProfile.getKnownExpressionLevel(factor4), is(nullValue()));
 }
Exemple #12
0
 @Test(expected = IllegalArgumentException.class)
 public void shouldThrowExceptionWhenQueryFactorsIsEmpty() {
   subject.getAverageExpressionLevelOn(new HashSet<Factor>());
 }
Exemple #13
0
 @Test
 public void testGetGeneSpecificity() throws Exception {
   assertThat(subject.getSpecificity(), is(3));
 }