@Test @Ignore public void test_write_interaction_inferred() throws XMLStreamException, IOException, IllegalRangeException { BinaryInteractionEvidence interaction = new DefaultNamedBinaryInteractionEvidence(); ParticipantEvidence participant = new DefaultNamedParticipantEvidence(InteractorUtils.createUnknownBasicInteractor()); ParticipantEvidence participant2 = new DefaultNamedParticipantEvidence(InteractorUtils.createUnknownBasicInteractor()); ParticipantEvidence participant3 = new DefaultNamedParticipantEvidence(InteractorUtils.createUnknownBasicInteractor()); ParticipantEvidence participant4 = new DefaultNamedParticipantEvidence(InteractorUtils.createUnknownBasicInteractor()); // two inferred interactiosn f1, f2, f3 and f3,f4 FeatureEvidence f1 = new DefaultFeatureEvidence(); f1.getRanges().add(RangeUtils.createRangeFromString("1-4")); FeatureEvidence f2 = new DefaultFeatureEvidence(); f2.getRanges().add(RangeUtils.createRangeFromString("1-4")); FeatureEvidence f3 = new DefaultFeatureEvidence(); f1.getLinkedFeatures().add(f2); f1.getLinkedFeatures().add(f3); f2.getLinkedFeatures().add(f1); f2.getLinkedFeatures().add(f3); f3.getLinkedFeatures().add(f1); f3.getLinkedFeatures().add(f2); participant.addFeature(f1); participant2.addFeature(f2); participant3.addFeature(f3); interaction.addParticipant(participant); interaction.addParticipant(participant2); elementCache.clear(); XmlNamedBinaryInteractionEvidenceWriter writer = new XmlNamedBinaryInteractionEvidenceWriter(createStreamWriter(), this.elementCache); writer.write(interaction); streamWriter.flush(); Assert.assertEquals(this.interaction_inferred, output.toString()); }
@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); }