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()); } }
/** * 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; }
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); } }
Organism organism1 = experiment1.getHostOrganism(); Organism organism2 = experiment2.getHostOrganism();
Organism organism1 = experiment1.getHostOrganism(); Organism organism2 = experiment2.getHostOrganism();
Organism organism1 = experiment1.getHostOrganism(); Organism organism2 = experiment2.getHostOrganism();
/*** * 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()); } }
if (experiment.getHostOrganism() != null){ checkOrganism(messages, experiment.getHostOrganism(), experiment, "experiment");
/*** * 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()); } } }
hashcode = 31*hashcode + UnambiguousCvTermComparator.hashCode(detMethod); Organism organism = exp.getHostOrganism(); hashcode = 31*hashcode + UnambiguousOrganismComparator.hashCode(organism);
hashcode = 31*hashcode + UnambiguousCvTermComparator.hashCode(detMethod); Organism organism = exp.getHostOrganism(); hashcode = 31*hashcode + UnambiguousOrganismComparator.hashCode(organism);
/** * 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; }
getCvWriter().write(experiment.getInteractionDetectionMethod()); if (experiment.getHostOrganism() != null){ MIJsonUtils.writeSeparator(this.writer); MIJsonUtils.writePropertyKey("host", writer); getHostOrganismWriter().write(experiment.getHostOrganism());