Ejemplo n.º 1
0
  @Test
  public void test_copy_basic_participant_properties_create_new_features() {

    Participant sourceParticipant =
        new DefaultParticipant(InteractorUtils.createUnknownBasicInteractor());
    sourceParticipant.setStoichiometry(new DefaultStoichiometry(3));
    sourceParticipant
        .getCausalRelationships()
        .add(
            new DefaultCausalRelationship(
                new DefaultCvTerm("decrease"), new DefaultParticipant(new DefaultProtein("p1"))));
    sourceParticipant.setBiologicalRole(new DefaultCvTerm("enzyme"));
    sourceParticipant.getAliases().add(new DefaultAlias("test alias"));
    sourceParticipant.getXrefs().add(new DefaultXref(new DefaultCvTerm("test database"), "xxxx"));
    sourceParticipant
        .getAnnotations()
        .add(new DefaultAnnotation(new DefaultCvTerm("test comment"), "comment"));
    ((Collection<Feature>) sourceParticipant.getFeatures())
        .add(new DefaultFeature("test", "test feature"));

    Participant targetParticipant = new DefaultParticipant(new DefaultProtein("p2"));

    ParticipantCloner.copyAndOverrideBasicParticipantProperties(
        sourceParticipant, targetParticipant, true);

    Assert.assertEquals(1, targetParticipant.getFeatures().size());
    Assert.assertFalse(
        targetParticipant.getFeatures().iterator().next()
            == sourceParticipant.getFeatures().iterator().next());
    Assert.assertTrue(
        DefaultFeatureBaseComparator.areEquals(
            (Feature) targetParticipant.getFeatures().iterator().next(),
            (Feature) sourceParticipant.getFeatures().iterator().next()));
  }
Ejemplo n.º 2
0
  @Test
  public void test_copy_participant_evidence_properties_create_new_features() {

    ParticipantEvidence sourceParticipant =
        new DefaultParticipantEvidence(InteractorUtils.createUnknownBasicInteractor());
    sourceParticipant.setStoichiometry(new DefaultStoichiometry(3));
    sourceParticipant
        .getCausalRelationships()
        .add(
            new DefaultCausalRelationship(
                new DefaultCvTerm("decrease"), new DefaultParticipant(new DefaultProtein("p1"))));
    sourceParticipant.setBiologicalRole(new DefaultCvTerm("enzyme"));
    sourceParticipant.getAliases().add(new DefaultAlias("test alias"));
    sourceParticipant.getXrefs().add(new DefaultXref(new DefaultCvTerm("test database"), "xxxx"));
    sourceParticipant
        .getAnnotations()
        .add(new DefaultAnnotation(new DefaultCvTerm("test comment"), "comment"));
    sourceParticipant.addFeature(new DefaultFeatureEvidence("test", "test feature"));
    sourceParticipant.setInteraction(new DefaultInteractionEvidence());
    sourceParticipant.setExperimentalRole(new DefaultCvTerm("bait"));
    sourceParticipant.setExpressedInOrganism(new DefaultOrganism(-1));
    sourceParticipant.getExperimentalPreparations().add(new DefaultCvTerm("test preparation"));
    sourceParticipant
        .getConfidences()
        .add(new DefaultConfidence(new DefaultCvTerm("author-score"), "high"));
    sourceParticipant
        .getParameters()
        .add(new DefaultParameter(new DefaultCvTerm("kd"), new ParameterValue(new BigDecimal(3))));

    ParticipantEvidence targetParticipant =
        new DefaultParticipantEvidence(new DefaultProtein("p2"));

    ParticipantCloner.copyAndOverrideParticipantEvidenceProperties(
        sourceParticipant, targetParticipant, true);

    Assert.assertEquals(1, targetParticipant.getFeatures().size());
    Assert.assertFalse(
        targetParticipant.getFeatures().iterator().next()
            == sourceParticipant.getFeatures().iterator().next());
    Assert.assertTrue(
        DefaultFeatureBaseComparator.areEquals(
            targetParticipant.getFeatures().iterator().next(),
            sourceParticipant.getFeatures().iterator().next()));
    Assert.assertTrue(
        targetParticipant.getFeatures().iterator().next().getParticipant() == targetParticipant);
  }