/*** * This method will copy properties of experiment source in experiment target and will override all the other properties of Target experiment. * This method will ignore interaction evidences * It will set the publication but will not add this experiment to the list of experiments of the publication reported in the source experiment * It will fully clone all the VariableParameters and set their experiment to the current experiment target * @param source * @param target */ public static void copyAndOverrideExperimentProperties(Experiment source, Experiment target){ if (source != null && target != null){ target.setHostOrganism(source.getHostOrganism()); target.setInteractionDetectionMethod(source.getInteractionDetectionMethod()); target.setPublication(source.getPublication()); // copy collections target.getAnnotations().clear(); target.getAnnotations().addAll(source.getAnnotations()); target.getXrefs().clear(); target.getXrefs().addAll(source.getXrefs()); target.getConfidences().clear(); target.getConfidences().addAll(source.getConfidences()); target.getVariableParameters().clear(); target.addAllVariableParameters(source.getVariableParameters()); } }
Map<CvTerm,Integer> frequencyMap = new HashMap<CvTerm, Integer>(exp.getInteractionEvidences().size()); int max=0; CvTerm commonDetectionMethod = null; if (exp != null && !exp.getInteractionEvidences().isEmpty()){ for (InteractionEvidence interaction : exp.getInteractionEvidences()){ for (ParticipantEvidence p : interaction.getParticipants()){ for (CvTerm identification : p.getIdentificationMethods()){
Publication pub1 = experiment1.getPublication(); Publication pub2 = experiment2.getPublication(); CvTerm detMethod1 = experiment1.getInteractionDetectionMethod(); CvTerm detMethod2 = experiment2.getInteractionDetectionMethod(); Organism organism1 = experiment1.getHostOrganism(); Organism organism2 = experiment2.getHostOrganism(); Collection<VariableParameter> variableParameters1 = experiment1.getVariableParameters(); Collection<VariableParameter> variableParameters2 = experiment2.getVariableParameters();
Publication publication = experiment.getPublication(); if (publication != null){ checkPublication(messages, publication, experiment); checkCv(messages, experiment.getInteractionDetectionMethod(), experiment, "experiment"); if (experiment.getHostOrganism() != null){ checkOrganism(messages, experiment.getHostOrganism(), experiment, "experiment"); for (Confidence c : experiment.getConfidences()){ checkConfidence(messages, c, experiment, "experiment"); for (Xref ref : experiment.getXrefs()){ checkXref(messages, ref, experiment, "experiment"); for (Annotation a : experiment.getAnnotations()){ checkAnnotation(messages, a, experiment, "experiment");
getCvWriter().write(experiment.getInteractionDetectionMethod()); if (experiment.getHostOrganism() != null){ MIJsonUtils.writeSeparator(this.writer); MIJsonUtils.writePropertyKey("host", writer); getHostOrganismWriter().write(experiment.getHostOrganism()); if (experiment.getPublication() != null){ MIJsonUtils.writeSeparator(this.writer); getPublicationWriter().write(experiment.getPublication()); Collection<Annotation> expModifications = AnnotationUtils.collectAllAnnotationsHavingTopic(experiment.getAnnotations(), Annotation.EXP_MODIFICATION_MI, Annotation.EXP_MODIFICATION); if (!expModifications.isEmpty()){
public static String getDoiId(Experiment exp){ if (exp == null){ return null; } else if (exp.getPublication() == null){ return null; } else{ return exp.getPublication().getDoi(); } }
public void onInteractionDetectionMethodUpdate(Experiment experiment, CvTerm oldCv) { if (oldCv == null){ experimentChangeLogger.log(Level.INFO, "The interaction detection method has been initialised for the experiment " + experiment.toString()); } else if (experiment.getInteractionDetectionMethod() == null){ experimentChangeLogger.log(Level.INFO, "The interaction detection method has been reset for the experiment " + experiment.toString()); } else { experimentChangeLogger.log(Level.INFO, "The interaction detection method " + oldCv + " has been updated with " + experiment.getInteractionDetectionMethod() + " in the experiment " + experiment.toString()); } }
/** * For each experiment associated with this interaction, collect all respective participants, host organisms and * check if the dependencies are correct. * * @param interaction an interaction to check on. * @return a collection of validator messages. * if we fail to retreive the MI Ontology. */ public Collection<ValidatorMessage> check( InteractionEvidence interaction ) throws ValidatorException { Collection<ValidatorMessage> messages = Collections.EMPTY_LIST; // experiments for detecting the interaction final Experiment experiment = interaction.getExperiment(); // participants of the interaction final Collection<ParticipantEvidence> participants = interaction.getParticipants(); // number of participants final int numberParticipants = participants.size(); final CvTerm interactionType = interaction.getInteractionType(); if (experiment != null){ // build a context in case of error MiContext context = RuleUtils.buildContext(interaction, "interaction"); context.addAssociatedContext(RuleUtils.buildContext(experiment, "experiment")); final CvTerm method = experiment.getInteractionDetectionMethod(); final Organism hostOrganism = experiment.getHostOrganism(); int numberOfBaits = getNumberOfParticipantWithExperimentalRole(participants, RuleUtils.BAIT_MI_REF, "bait"); int numberOfPreys = getNumberOfParticipantWithExperimentalRole(participants, RuleUtils.PREY_MI_REF, "prey"); messages = mapping.check( method, interactionType, hostOrganism, numberParticipants, numberOfBaits, numberOfPreys, context, this ); } return messages; }
public void onHostOrganismUpdate(Experiment experiment, Organism oldOrganism) { if (oldOrganism == null){ experimentChangeLogger.log(Level.INFO, "The host organism has been initialised for the experiment " + experiment.toString()); } else if (experiment.getHostOrganism() == null){ experimentChangeLogger.log(Level.INFO, "The host organism has been reset for the experiment " + experiment.toString()); } else { experimentChangeLogger.log(Level.INFO, "The host organism " + oldOrganism + " has been updated with " + experiment.getHostOrganism() + " in the experiment " + experiment.toString()); } }
final Collection<Annotation> expAtts = AnnotationUtils.collectAllAnnotationsHavingTopic( interaction.getExperiment().getAnnotations(), CONFIDENCE_MAPPING_MI_REF, CONFIDENCE_MAPPING); final Collection<Annotation> expAtts = AnnotationUtils.collectAllAnnotationsHavingTopic( interaction.getExperiment().getAnnotations(), CONFIDENCE_MAPPING_MI_REF, CONFIDENCE_MAPPING);
/** * For each cross reference of this XrefContainer, collects all respective cross reference type(s) and * check if the dependencies are correct. * * @param container to check on. * @return a collection of validator messages. * if we fail to retreive the MI Ontology. */ public Collection<ValidatorMessage> check( Experiment container) throws ValidatorException { Collection<ValidatorMessage> messages = Collections.EMPTY_LIST; // Collect the db references Collection<Xref> databaseReferences = container.getXrefs(); if (!databaseReferences.isEmpty()){ messages = new ArrayList<ValidatorMessage>(); for ( Xref reference : databaseReferences) { MiContext context = RuleUtils.buildContext(reference, "database cross reference"); context.addAssociatedContext(RuleUtils.buildContext(container, "experiment")); // build a context in case of error messages.addAll( mapping.check( reference.getDatabase(), reference.getQualifier(), context, this ) ); } } return messages; }
Publication pub1 = experiment1.getPublication(); Publication pub2 = experiment2.getPublication(); CvTerm detMethod1 = experiment1.getInteractionDetectionMethod(); CvTerm detMethod2 = experiment2.getInteractionDetectionMethod(); Organism organism1 = experiment1.getHostOrganism(); Organism organism2 = experiment2.getHostOrganism(); Collection<VariableParameter> variableParameters1 = experiment1.getVariableParameters(); Collection<VariableParameter> variableParameters2 = experiment2.getVariableParameters();
public static String getPubmedId(Experiment exp){ if (exp == null){ return null; } else if (exp.getPublication() == null){ return null; } else{ return exp.getPublication().getPubmedId(); } }
@Override protected CvTerm extractInteractionDetectionMethodFrom(InteractionEvidence interaction) { return interaction.getExperiment() != null ? interaction.getExperiment().getInteractionDetectionMethod() : null; } }
public void writeHostOrganism(BinaryInteractionEvidence interaction) throws IOException { Experiment experiment = interaction.getExperiment(); // writes interaction annotations first if (experiment != null){ writeOrganism(experiment.getHostOrganism()); } else{ getWriter().write(MitabUtils.EMPTY_COLUMN); } }
/*** * This method will copy properties of experiment source in experiment target and will override all the other properties of Target experiment. * This method will also move interaction evidences from source to target * It will set the publication but will not add this experiment to the list of experiments of the publication reported in the source experiment * It will fully clone all the VariableParameters and set their experiment to the current experiment target * @param source * @param target */ public static void copyAndOverrideExperimentPropertiesAndInteractionEvidences(Experiment source, Experiment target){ if (source != null && target != null){ target.setHostOrganism(source.getHostOrganism()); target.setInteractionDetectionMethod(source.getInteractionDetectionMethod()); target.setPublication(source.getPublication()); // copy collections target.getAnnotations().clear(); target.getAnnotations().addAll(source.getAnnotations()); target.getXrefs().clear(); target.getXrefs().addAll(source.getXrefs()); target.getConfidences().clear(); target.getConfidences().addAll(source.getConfidences()); target.getVariableParameters().clear(); target.addAllVariableParameters(source.getVariableParameters()); target.getInteractionEvidences().clear(); target.addAllInteractionEvidences(source.getInteractionEvidences()); } } }
Publication pub1 = experiment1.getPublication(); Publication pub2 = experiment2.getPublication(); CvTerm detMethod1 = experiment1.getInteractionDetectionMethod(); CvTerm detMethod2 = experiment2.getInteractionDetectionMethod(); Organism organism1 = experiment1.getHostOrganism(); Organism organism2 = experiment2.getHostOrganism(); Collection<VariableParameter> variableParameters1 = experiment1.getVariableParameters(); Collection<VariableParameter> variableParameters2 = experiment2.getVariableParameters();
public void onPublicationUpdate(Experiment experiment, Publication oldPublication) { if (oldPublication == null){ experimentChangeLogger.log(Level.INFO, "The publication has been initialised for the experiment " + experiment.toString()); } else if (experiment.getPublication() == null){ experimentChangeLogger.log(Level.INFO, "The publication has been reset for the experiment " + experiment.toString()); } else { experimentChangeLogger.log(Level.INFO, "The publication " + oldPublication + " has been updated with " + experiment.getPublication() + " in the experiment " + experiment.toString()); } }
public void writeInteractionDetectionMethod(BinaryInteractionEvidence interaction) throws IOException { Experiment experiment = interaction.getExperiment(); if (experiment != null){ writeCvTerm(experiment.getInteractionDetectionMethod()); } else{ getWriter().write(MitabUtils.EMPTY_COLUMN); } }
/** * Checks that each experiment has an host organisms element. * * @param experiment an interaction to check on. * @return a collection of validator messages. */ public Collection<ValidatorMessage> check( Experiment experiment ) throws ValidatorException { Collection<ValidatorMessage> messages = Collections.EMPTY_LIST; // check on host organism Organism hostOrganism = experiment.getHostOrganism(); if ( hostOrganism == null ) { MiContext context = RuleUtils.buildContext(experiment, "experiment"); messages=Collections.singleton( new ValidatorMessage( "The experiment does not have a host organism and it is required for MIMIx.", MessageLevel.ERROR, context, this ) ); } return messages; }