예제 #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()));
  }
예제 #2
0
  @Test
  public void test_copy_modelled_participant_properties() {

    ModelledParticipant sourceParticipant =
        new DefaultModelledParticipant(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 DefaultModelledFeature("test", "test feature"));
    sourceParticipant.setInteraction(new DefaultModelledInteraction());

    ModelledParticipant targetParticipant =
        new DefaultModelledParticipant(new DefaultProtein("p2"));

    ParticipantCloner.copyAndOverrideModelledParticipantProperties(
        sourceParticipant, targetParticipant, false);

    Assert.assertEquals(1, targetParticipant.getXrefs().size());
    Assert.assertEquals(1, targetParticipant.getAnnotations().size());
    Assert.assertEquals(1, targetParticipant.getAliases().size());
    Assert.assertEquals(1, targetParticipant.getFeatures().size());
    Assert.assertNull(targetParticipant.getInteraction());
    Assert.assertTrue(
        targetParticipant.getXrefs().iterator().next()
            == sourceParticipant.getXrefs().iterator().next());
    Assert.assertTrue(
        targetParticipant.getAliases().iterator().next()
            == sourceParticipant.getAliases().iterator().next());
    Assert.assertTrue(
        targetParticipant.getAnnotations().iterator().next()
            == sourceParticipant.getAnnotations().iterator().next());
    Assert.assertTrue(
        targetParticipant.getFeatures().iterator().next()
            == sourceParticipant.getFeatures().iterator().next());
    Assert.assertTrue(targetParticipant.getInteractor() == sourceParticipant.getInteractor());
    Assert.assertTrue(targetParticipant.getStoichiometry() == sourceParticipant.getStoichiometry());
    Assert.assertTrue(
        targetParticipant.getBiologicalRole() == sourceParticipant.getBiologicalRole());
    Assert.assertTrue(
        targetParticipant.getCausalRelationships().iterator().next()
            == sourceParticipant.getCausalRelationships().iterator().next());
    Assert.assertTrue(
        targetParticipant.getFeatures().iterator().next().getParticipant() == sourceParticipant);
  }
예제 #3
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);
  }