/** * Retrieves the confidences from an interaction, initializing them if necessary. * Do not set the initialized collection of confidences because confidences cannot be orphan * @param interaction the interaction * @return The returned confidences are ensured to be initialized * @since 2.4.0 */ public static Collection<Confidence> ensureInitializedConfidences(Interaction interaction) { Collection<Confidence> confidences; if (IntactCore.isInitialized(interaction.getConfidences())) { confidences = interaction.getConfidences(); } else { confidences = IntactContext.getCurrentInstance().getDaoFactory().getConfidenceDao().getByInteractionAc(interaction.getAc()); } return confidences; }
/** * Retrieves the confidences from an interaction, initializing them if necessary. * Do not set the initialized collection of confidences because confidences cannot be orphan * @param interaction the interaction * @return The returned confidences are ensured to be initialized * @since 2.4.0 */ public static Collection<Confidence> ensureInitializedConfidences(Interaction interaction) { Collection<Confidence> confidences; if (IntactCore.isInitialized(interaction.getConfidences())) { confidences = interaction.getConfidences(); } else { confidences = IntactContext.getCurrentInstance().getDaoFactory().getConfidenceDao().getByInteractionAc(interaction.getAc()); } return confidences; }
confidences = ((Interaction)annotatedObject).getConfidences();
protected void failIfInconsistentConversion(Interaction intact, psidev.psi.mi.xml.model.Interaction psi, int numberOfAuthorConfAttributes) { Collection<Experiment> experiments; Collection<Component> participants; Collection<Confidence> confidences; if (isCheckInitializedCollections()){ experiments = IntactCore.ensureInitializedExperiments(intact); participants = IntactCore.ensureInitializedParticipants(intact); confidences = IntactCore.ensureInitializedConfidences(intact); } else { experiments = intact.getExperiments(); participants = intact.getComponents(); confidences = intact.getConfidences(); } failIfInconsistentCollectionSize("experiment", experiments, psi.getExperiments()); failIfInconsistentCollectionSize("participant", participants, psi.getParticipants()); Collection<Confidence> confs = confidences; if (confs.size() > 0 && psi.getConfidences().size() + numberOfAuthorConfAttributes > 0 && confs.size() != (psi.getConfidences().size() + numberOfAuthorConfAttributes)) { throw new InconsistentConversionException("Confidence", confs.size(), psi.getConfidences().size() + numberOfAuthorConfAttributes); } }
protected void failIfInconsistentPsiConversion(Interaction intact, psidev.psi.mi.xml.model.Interaction psi) { Collection<Experiment> experiments; Collection<Component> participants; Collection<Confidence> confidences; if (isCheckInitializedCollections()){ experiments = IntactCore.ensureInitializedExperiments(intact); participants = IntactCore.ensureInitializedParticipants(intact); confidences = IntactCore.ensureInitializedConfidences(intact); } else { experiments = intact.getExperiments(); participants = intact.getComponents(); confidences = intact.getConfidences(); } failIfInconsistentCollectionSize("experiment", experiments, psi.getExperiments()); failIfInconsistentCollectionSize("participant", participants, psi.getParticipants()); Collection<Confidence> confs = confidences; if (confs.size() > 0 && psi.getConfidences().size() > 0 && (confs.size()) != psi.getConfidences().size()) { throw new InconsistentConversionException("Confidence", confs.size(), psi.getConfidences().size()); } }
private void synchronizeInteraction( Interaction interaction, boolean synchronizeAnnotatedAttributes ) { interaction.setCvInteractionType( synchronize( interaction.getCvInteractionType() ) ); interaction.setCvInteractorType( synchronize( interaction.getCvInteractorType() ) ); if (IntactCore.isInitializedAndDirty(interaction.getComponents())){ Collection<Component> components = synchronizeCollection(interaction.getComponents()); interaction.getComponents().clear(); interaction.getComponents().addAll(components); } interaction.setBioSource( synchronize( interaction.getBioSource() ) ); if (IntactCore.isInitializedAndDirty(interaction.getExperiments())){ Collection<Experiment> experiment = synchronizeCollection(interaction.getExperiments()); interaction.getExperiments().clear(); interaction.getExperiments().addAll(experiment); } // cannot call setConfidences in interaction because of orphan relationship limitation if (IntactCore.isInitializedAndDirty(interaction.getConfidences())){ Collection<Confidence> confidences = synchronizeConfidences(interaction.getConfidences(), interaction); interaction.getConfidences().clear(); interaction.getConfidences().addAll(confidences); } // cannot call setParameters in interaction because of orphan relationship limitation if (IntactCore.isInitializedAndDirty(interaction.getParameters())){ Collection<InteractionParameter> interactionParameters = synchronizeInteractionParameters(interaction.getParameters(), interaction); interaction.getParameters().clear(); interaction.getParameters().addAll(interactionParameters); } if (synchronizeAnnotatedAttributes){ synchronizeAnnotatedObjectCommons( interaction ); } }
private void synchronizeInteraction( Interaction interaction, boolean synchronizeAnnotatedAttributes ) { interaction.setCvInteractionType( synchronize( interaction.getCvInteractionType() ) ); interaction.setCvInteractorType( synchronize( interaction.getCvInteractorType() ) ); if (IntactCore.isInitializedAndDirty(interaction.getComponents())){ Collection<Component> components = synchronizeCollection(interaction.getComponents()); interaction.getComponents().clear(); interaction.getComponents().addAll(components); } interaction.setBioSource( synchronize( interaction.getBioSource() ) ); if (IntactCore.isInitializedAndDirty(interaction.getExperiments())){ Collection<Experiment> experiment = synchronizeCollection(interaction.getExperiments()); interaction.getExperiments().clear(); interaction.getExperiments().addAll(experiment); } // cannot call setConfidences in interaction because of orphan relationship limitation if (IntactCore.isInitializedAndDirty(interaction.getConfidences())){ Collection<Confidence> confidences = synchronizeConfidences(interaction.getConfidences(), interaction); interaction.getConfidences().clear(); interaction.getConfidences().addAll(confidences); } // cannot call setParameters in interaction because of orphan relationship limitation if (IntactCore.isInitializedAndDirty(interaction.getParameters())){ Collection<InteractionParameter> interactionParameters = synchronizeInteractionParameters(interaction.getParameters(), interaction); interaction.getParameters().clear(); interaction.getParameters().addAll(interactionParameters); } if (synchronizeAnnotatedAttributes){ synchronizeAnnotatedObjectCommons( interaction ); } }
protected void copyInteraction( Interaction source, Interaction target ) { copyProperty(source, "KD", target); copyProperty(source, "crc", target); copyProperty(source, "cvInteractionType", target); copyCollection( source.getComponents(), target.getComponents() ); copyCollection( source.getExperiments(), target.getExperiments() ); copyCollection( source.getConfidences(), target.getConfidences() ); copyCollection( source.getParameters(), target.getParameters() ); copyInteractorCommons( source, target ); // we have ommited CRC on purpose }
protected void copyInteraction( Interaction source, Interaction target ) { copyProperty(source, "KD", target); copyProperty(source, "crc", target); copyProperty(source, "cvInteractionType", target); copyCollection( source.getComponents(), target.getComponents() ); copyCollection( source.getExperiments(), target.getExperiments() ); copyCollection( source.getConfidences(), target.getConfidences() ); copyCollection( source.getParameters(), target.getParameters() ); copyInteractorCommons( source, target ); // we have ommited CRC on purpose }
if (!interaction.getConfidences().isEmpty()){ for (uk.ac.ebi.intact.model.Confidence conf : interaction.getConfidences()){ Confidence confField = confidenceConverter.intactToCalimocho(conf);
protected void traverseInteraction(Interaction interaction, IntactVisitor ... visitors) { if (interaction == null) return; for (IntactVisitor visitor : visitors) { visitor.visitInteraction(interaction); } // check if this element has been traversed already, to avoid cyclic recursion if (recursionChecker.isAlreadyTraversed(interaction)) { return; } traverse(interaction.getCvInteractionType(), visitors); traverse(interaction.getExperiments(), visitors); traverse(interaction.getComponents(), visitors); traverse(interaction.getConfidences(), visitors); traverse(interaction.getParameters(), visitors); }
protected void traverseInteraction(Interaction interaction, IntactVisitor ... visitors) { if (interaction == null) return; for (IntactVisitor visitor : visitors) { visitor.visitInteraction(interaction); } // check if this element has been traversed already, to avoid cyclic recursion if (recursionChecker.isAlreadyTraversed(interaction)) { return; } traverse(interaction.getCvInteractionType(), visitors); traverse(interaction.getExperiments(), visitors); traverse(interaction.getComponents(), visitors); traverse(interaction.getConfidences(), visitors); traverse(interaction.getParameters(), visitors); }
experiments = intactObject.getExperiments(); components = intactObject.getComponents(); confidences = intactObject.getConfidences(); parameters = intactObject.getParameters(); annotations = intactObject.getAnnotations();
protected void failIfInconsistentConversion(Interaction intact, psidev.psi.mi.xml.model.Interaction psi) { Collection<Experiment> experiments; Collection<Component> participants; Collection<Confidence> confidences; if (isCheckInitializedCollections()){ experiments = IntactCore.ensureInitializedExperiments(intact); participants = IntactCore.ensureInitializedParticipants(intact); confidences = IntactCore.ensureInitializedConfidences(intact); } else { experiments = intact.getExperiments(); participants = intact.getComponents(); confidences = intact.getConfidences(); } failIfInconsistentCollectionSize("experiment", experiments, psi.getExperiments()); failIfInconsistentCollectionSize("participant", participants, psi.getParticipants()); failIfInconsistentCollectionSize( "confidence", confidences, psi.getConfidences()); }
clone.setCrc(interaction.getCrc()); if (isCollectionClonable(interaction.getConfidences())) { Collection<Confidence> confidences = IntactCore.ensureInitializedConfidences(interaction);
clone.setCrc(interaction.getCrc()); if (isCollectionClonable(interaction.getConfidences())) { Collection<Confidence> confidences = IntactCore.ensureInitializedConfidences(interaction);