public GeneratedEntry addExperiment(Experiment experiment) { if (experiment == null) throw new NullPointerException("experiment"); for (Interaction interaction : experiment.getInteractions()) { addInteraction(interaction); } return this; }
public GeneratedEntry addExperiment(Experiment experiment) { if (experiment == null) throw new NullPointerException("experiment"); for (Interaction interaction : experiment.getInteractions()) { addInteraction(interaction); } return this; }
public GeneratedEntry addExperiment(Experiment experiment) { if (experiment == null) throw new NullPointerException("experiment"); for (Interaction interaction : experiment.getInteractions()) { addInteraction(interaction); } return this; }
public IntactEntry createIntactEntryRandom(int experimentNumber, int minInteractionsPerExperiment, int maxInteractionsPerExpeciment) { Collection<Interaction> interactions = new ArrayList<Interaction>(); for (int i=0; i<experimentNumber; i++) { Experiment exp = createExperimentRandom(childRandom(minInteractionsPerExperiment, maxInteractionsPerExpeciment)); interactions.addAll(exp.getInteractions()); } return new IntactEntry(interactions); }
public IntactEntry createIntactEntryRandom(int experimentNumber, int minInteractionsPerExperiment, int maxInteractionsPerExpeciment) { Collection<Interaction> interactions = new ArrayList<Interaction>(); for (int i=0; i<experimentNumber; i++) { Experiment exp = createExperimentRandom(childRandom(minInteractionsPerExperiment, maxInteractionsPerExpeciment)); interactions.addAll(exp.getInteractions()); } return new IntactEntry(interactions); }
public IntactEntry createIntactEntryRandom(int experimentNumber, int minInteractionsPerExperiment, int maxInteractionsPerExpeciment) { Collection<Interaction> interactions = new ArrayList<Interaction>(); for (int i=0; i<experimentNumber; i++) { Experiment exp = createExperimentRandom(childRandom(minInteractionsPerExperiment, maxInteractionsPerExpeciment)); interactions.addAll(exp.getInteractions()); } return new IntactEntry(interactions); }
protected void copyExperiment( Experiment source, Experiment target ) { copyProperty(source, "bioSource", target); copyProperty(source, "publication", target); copyProperty(source, "cvIdentification", target); copyProperty(source, "cvInteraction", target); copyCollection( source.getInteractions(), target.getInteractions() ); }
protected void copyExperiment( Experiment source, Experiment target ) { copyProperty(source, "bioSource", target); copyProperty(source, "publication", target); copyProperty(source, "cvIdentification", target); copyProperty(source, "cvInteraction", target); copyCollection( source.getInteractions(), target.getInteractions() ); }
private boolean isPublicationEligibleForDataset(Publication p){ // the publication is not excluded by the selector if (this.selector.getPublicationsIdToExclude().contains(p.getShortLabel())){ return false; } // all the experiments must contain less than 100 interactions for (Experiment exp : p.getExperiments()){ if (this.selector.getMaxNumberOfInteractionsPerExperiment() <= exp.getInteractions().size()){ return false; } } return true; }
/** * Retrieves the interactions from an experiment, initializing them if necessary. * * @param experiment the experiment * @return The returned interactions are ensured to be initialized * @since 2.4.0 */ public static Collection<Interaction> ensureInitializedInteractions(Experiment experiment) { Collection<Interaction> interactions; if (IntactCore.isInitialized(experiment.getInteractions())) { interactions = experiment.getInteractions(); } else { interactions = IntactContext.getCurrentInstance().getDaoFactory().getInteractionDao().getByExperimentAc(experiment.getAc(), 0, Integer.MAX_VALUE); } return interactions; }
private void synchronizeExperiment( Experiment experiment, boolean synchronizeAnnotatedAttributes ) { experiment.setPublication( synchronize( experiment.getPublication() ) ); if (IntactCore.isInitializedAndDirty(experiment.getInteractions())){ Collection<Interaction> interactions = synchronizeCollection(experiment.getInteractions()); experiment.getInteractions().clear(); experiment.getInteractions().addAll(interactions); } experiment.setCvIdentification(synchronize(experiment.getCvIdentification())); experiment.setCvInteraction( synchronize( experiment.getCvInteraction() ) ); experiment.setBioSource( synchronize( experiment.getBioSource() ) ); if (synchronizeAnnotatedAttributes){ synchronizeAnnotatedObjectCommons( experiment ); } }
/** * Retrieves the interactions from an experiment, initializing them if necessary. * * @param experiment the experiment * @return The returned interactions are ensured to be initialized * @since 2.4.0 */ public static Collection<Interaction> ensureInitializedInteractions(Experiment experiment) { Collection<Interaction> interactions; if (IntactCore.isInitialized(experiment.getInteractions())) { interactions = experiment.getInteractions(); } else { interactions = IntactContext.getCurrentInstance().getDaoFactory().getInteractionDao().getByExperimentAc(experiment.getAc(), 0, Integer.MAX_VALUE); } return interactions; }
private void synchronizeExperiment( Experiment experiment, boolean synchronizeAnnotatedAttributes ) { experiment.setPublication( synchronize( experiment.getPublication() ) ); if (IntactCore.isInitializedAndDirty(experiment.getInteractions())){ Collection<Interaction> interactions = synchronizeCollection(experiment.getInteractions()); experiment.getInteractions().clear(); experiment.getInteractions().addAll(interactions); } experiment.setCvIdentification(synchronize(experiment.getCvIdentification())); experiment.setCvInteraction( synchronize( experiment.getCvInteraction() ) ); experiment.setBioSource( synchronize( experiment.getBioSource() ) ); if (synchronizeAnnotatedAttributes){ synchronizeAnnotatedObjectCommons( experiment ); } }
public Collection<GeneralMessage> check(Experiment experiment) throws SanityRuleException { Collection<GeneralMessage> messages = new ArrayList<GeneralMessage>(); int interactionCount = 0; if (experiment.getAc() != null) { interactionCount = IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getExperimentDao().countInteractionsForExperimentWithAc(experiment.getAc()); } if (interactionCount == 0) { interactionCount = experiment.getInteractions().size(); } if(interactionCount == 0){ messages.add(new GeneralMessage( MessageDefinition.EXPERIMENT_WITHOUT_INTERACTION, experiment )); } return messages; } }
public Interaction createInteractionRandomBinary(String imexId) { CvInteractionType cvInteractionType = createCvObject(CvInteractionType.class, CvInteractionType.DIRECT_INTERACTION_MI_REF, CvInteractionType.DIRECT_INTERACTION); CvInteractorType intType = createCvObject(CvInteractorType.class, CvInteractorType.INTERACTION_MI_REF, CvInteractorType.INTERACTION ); Experiment experimentEmpty = createExperimentEmpty(); Interaction interaction = new InteractionImpl(new ArrayList<Experiment>(Arrays.asList(experimentEmpty)), cvInteractionType, intType, nextString("label"), getInstitution()); experimentEmpty.getInteractions().add(interaction); createComponentBait(interaction, createProteinRandom()); createComponentPrey(interaction, createProteinRandom()); String shortLabel = InteractionUtils.calculateShortLabel(interaction); interaction.setShortLabel(shortLabel); if (imexId != null) { CvObjectBuilder cvBuilder = new CvObjectBuilder(); CvXrefQualifier idQual = cvBuilder.createIdentityCvXrefQualifier(getInstitution()); CvDatabase imexDb = createCvObject(CvDatabase.class, CvDatabase.IMEX_MI_REF, CvDatabase.IMEX); interaction.addXref(new InteractorXref(getInstitution(), imexDb, imexId, idQual)); } return interaction; }
public Interaction createInteractionRandomBinary(String imexId) { CvInteractionType cvInteractionType = createCvObject(CvInteractionType.class, CvInteractionType.DIRECT_INTERACTION_MI_REF, CvInteractionType.DIRECT_INTERACTION); CvInteractorType intType = createCvObject(CvInteractorType.class, CvInteractorType.INTERACTION_MI_REF, CvInteractorType.INTERACTION ); Experiment experimentEmpty = createExperimentEmpty(); Interaction interaction = new InteractionImpl(new ArrayList<Experiment>(Arrays.asList(experimentEmpty)), cvInteractionType, intType, nextString("label"), getInstitution()); experimentEmpty.getInteractions().add(interaction); createComponentBait(interaction, createProteinRandom()); createComponentPrey(interaction, createProteinRandom()); String shortLabel = InteractionUtils.calculateShortLabel(interaction); interaction.setShortLabel(shortLabel); if (imexId != null) { CvObjectBuilder cvBuilder = new CvObjectBuilder(); CvXrefQualifier idQual = cvBuilder.createIdentityCvXrefQualifier(getInstitution()); CvDatabase imexDb = createCvObject(CvDatabase.class, CvDatabase.IMEX_MI_REF, CvDatabase.IMEX); interaction.addXref(new InteractorXref(getInstitution(), imexDb, imexId, idQual)); } return interaction; }
protected void traverseExperiment(Experiment experiment, IntactVisitor ... visitors) { if (experiment == null) return; for (IntactVisitor visitor : visitors) { visitor.visitExperiment(experiment); } // check if this element has been traversed already, to avoid cyclic recursion if (recursionChecker.isAlreadyTraversed(experiment)) { return; } traverse(experiment.getCvIdentification(), visitors); traverse(experiment.getCvInteraction(), visitors); traverse(experiment.getBioSource(), visitors); traverse(experiment.getPublication(), visitors); traverse(experiment.getInteractions(), visitors); }
protected void traverseExperiment(Experiment experiment, IntactVisitor ... visitors) { if (experiment == null) return; for (IntactVisitor visitor : visitors) { visitor.visitExperiment(experiment); } // check if this element has been traversed already, to avoid cyclic recursion if (recursionChecker.isAlreadyTraversed(experiment)) { return; } traverse(experiment.getCvIdentification(), visitors); traverse(experiment.getCvInteraction(), visitors); traverse(experiment.getBioSource(), visitors); traverse(experiment.getPublication(), visitors); traverse(experiment.getInteractions(), visitors); }
public Experiment cloneExperiment(Experiment experiment) throws IntactClonerException { if (experiment == null) return null; Experiment clone = new Experiment(); clonerManager.addClone(experiment, clone); clone.setCvIdentification(clone(experiment.getCvIdentification())); clone.setCvInteraction(clone(experiment.getCvInteraction())); clone.setBioSource(clone(experiment.getBioSource())); clone.setPublication(clone(experiment.getPublication())); if (isCollectionClonable(experiment.getInteractions())) { Collection<Interaction> interactions = IntactCore.ensureInitializedInteractions(experiment); for (Interaction i : interactions) { clone.addInteraction(clone(i)); } } return clone; }
public Experiment cloneExperiment(Experiment experiment) throws IntactClonerException { if (experiment == null) return null; Experiment clone = new Experiment(); clonerManager.addClone(experiment, clone); clone.setCvIdentification(clone(experiment.getCvIdentification())); clone.setCvInteraction(clone(experiment.getCvInteraction())); clone.setBioSource(clone(experiment.getBioSource())); clone.setPublication(clone(experiment.getPublication())); if (isCollectionClonable(experiment.getInteractions())) { Collection<Interaction> interactions = IntactCore.ensureInitializedInteractions(experiment); for (Interaction i : interactions) { clone.addInteraction(clone(i)); } } return clone; }