/*** * 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()); } }
/** * 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; }
/*** * 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()); } } }
for (Xref ref : experiment.getXrefs()){ checkXref(messages, ref, experiment, "experiment");