target.setExperimentalRole(source.getExperimentalRole()); target.setExpressedInOrganism(source.getExpressedInOrganism()); target.setBiologicalRole(source.getBiologicalRole()); target.setStoichiometry(source.getStoichiometry()); target.getCausalRelationships().clear(); target.getCausalRelationships().addAll(source.getCausalRelationships()); target.getAnnotations().clear(); target.getAnnotations().addAll(source.getAnnotations()); target.getConfidences().clear(); target.getConfidences().addAll(source.getConfidences()); target.getXrefs().clear(); target.getXrefs().addAll(source.getXrefs()); target.getAliases().clear(); target.getAliases().addAll(source.getAliases()); target.getExperimentalPreparations().clear(); target.getExperimentalPreparations().addAll(source.getExperimentalPreparations()); target.getParameters().clear(); target.getParameters().addAll(source.getParameters()); target.getIdentificationMethods().clear(); target.getIdentificationMethods().addAll(source.getIdentificationMethods()); target.setInteractor(source.getInteractor()); target.getFeatures().clear(); target.getFeatures().addAll(source.getFeatures()); target.getFeatures().clear(); for (FeatureEvidence f : source.getFeatures()){
CvTerm expRoles1 = experimentalParticipant1.getExperimentalRole(); CvTerm expRoles2 = experimentalParticipant2.getExperimentalRole(); Collection<CvTerm> method1 = experimentalParticipant1.getIdentificationMethods(); Collection<CvTerm> method2 = experimentalParticipant2.getIdentificationMethods(); Collection<CvTerm> prep1 = experimentalParticipant1.getExperimentalPreparations(); Collection<CvTerm> prep2 = experimentalParticipant2.getExperimentalPreparations(); Organism organism1 = experimentalParticipant1.getExpressedInOrganism(); Organism organism2 = experimentalParticipant2.getExpressedInOrganism(); Collection<Parameter> param1 = experimentalParticipant1.getParameters(); Collection<Parameter> param2 = experimentalParticipant2.getParameters(); Collection<FeatureEvidence> features1 = experimentalParticipant1.getFeatures(); Collection<FeatureEvidence> features2 = experimentalParticipant2.getFeatures();
/** * For each experiment associated with this interaction, collect all respective participants and their identification method and * check if the dependencies are correct. * * @param participant a participant to check on. * @return a collection of validator messages. * if we fail to retreive the MI Ontology. */ public Collection<ValidatorMessage> check( ParticipantEvidence participant ) throws ValidatorException { Collection<ValidatorMessage> messages = Collections.EMPTY_LIST; if (participant.getInteraction() != null){ InteractionEvidence interaction = participant.getInteraction(); Experiment exp = interaction.getExperiment(); if (exp != null){ CvTerm detMethod = exp.getInteractionDetectionMethod(); if (detMethod != null){ if (!participant.getIdentificationMethods().isEmpty()){ messages = new ArrayList<ValidatorMessage>(participant.getIdentificationMethods().size()); for (CvTerm method : participant.getIdentificationMethods()){ // build a context in case of error MiContext context = RuleUtils.buildContext(participant, "participant"); context.addAssociatedContext(RuleUtils.buildContext(exp, "experiment")); messages.addAll( mapping.check( detMethod, method, context, this ) ); } } } } } return messages; }
if (p.getInteractor() != null && this.processObjects.add(p.getInteractor())){ checkInteractor(messages, p.getInteractor()); for (FeatureEvidence f : p.getFeatures()){ checkFeature(messages, f, p, parent); if (p.getBiologicalRole() != null){ checkCv(messages, p.getBiologicalRole(), p, "participant"); if (p.getExperimentalRole() != null){ checkCv(messages, p.getExperimentalRole(), p, "participant"); for (CvTerm term : p.getIdentificationMethods()){ checkCv(messages, term, p, "participant"); for (CvTerm term : p.getExperimentalPreparations()){ checkCv(messages, term, p, "participant"); for (Confidence c : p.getConfidences()){ checkConfidence(messages, c, p, "participant"); for (Parameter param : p.getParameters()){ checkParameter(messages, param, p, "participant"); for (Alias alias : p.getAliases()){ checkAlias(messages, alias, p, "participant"); for (Xref ref : p.getXrefs()){ checkXref(messages, ref, p, "participant");
getCvWriter().write(object.getExperimentalRole()); if (!object.getIdentificationMethods().isEmpty()){ MIJsonUtils.writeSeparator(getWriter()); MIJsonUtils.writePropertyKey("identificationMethods", getWriter()); MIJsonUtils.writeOpenArray(getWriter()); Iterator<CvTerm> methodIterator = object.getIdentificationMethods().iterator(); while (methodIterator.hasNext()){ getCvWriter().write(methodIterator.next()); if (object.getExpressedInOrganism() != null){ MIJsonUtils.writeSeparator(getWriter()); MIJsonUtils.writePropertyKey("expressedIn", getWriter()); getHostOrganismWriter().write(object.getExpressedInOrganism()); if (!object.getConfidences().isEmpty()){ MIJsonUtils.writeSeparator(getWriter()); MIJsonUtils.writePropertyKey("confidences", getWriter()); MIJsonUtils.writeOpenArray(getWriter()); Iterator<Confidence> confIterator = object.getConfidences().iterator(); while (confIterator.hasNext()){ getConfidenceWriter().write(confIterator.next()); if (!object.getParameters().isEmpty()){ MIJsonUtils.writeSeparator(getWriter()); MIJsonUtils.writePropertyKey("parameters", getWriter()); MIJsonUtils.writeOpenArray(getWriter());
/** * * @param participants * @param roleMi * @param roleName * @return the number of participants with a specific experimental role */ private int getNumberOfParticipantWithExperimentalRole(Collection<? extends ParticipantEvidence> participants, String roleMi, String roleName){ int num = 0; for (ParticipantEvidence p : participants){ CvTerm experimentRole = p.getExperimentalRole(); if (checkParticipantRole(experimentRole, roleMi, roleName)){ num++; } } return num; }
/** * Method to know if a participant evidence has a self experimental or biological role * @param p * @return */ public static boolean isSelfParticipantEvidence(ParticipantEvidence p){ if (p == null){ return false; } CvTerm experimentalRole = p.getExperimentalRole(); CvTerm biologicalRole = p.getBiologicalRole(); return DefaultCvTermComparator.areEquals(CvTermUtils.getSelf(), experimentalRole) || DefaultCvTermComparator.areEquals(CvTermUtils.getSelf(), biologicalRole) ; }
/** * For each experiment associated with this interaction, collect all respective participants and their experimental roles and * check if the dependencies are correct. * * @param participant a participant to check on. * @return a collection of validator messages. * if we fail to retreive the MI Ontology. */ public Collection<ValidatorMessage> check( ParticipantEvidence participant ) throws ValidatorException { Collection<ValidatorMessage> messages = Collections.EMPTY_LIST; CvTerm role = participant.getExperimentalRole(); if (participant.getInteraction() != null){ InteractionEvidence interaction = participant.getInteraction(); Experiment exp = interaction.getExperiment(); if (exp != null){ // build a context in case of error MiContext context = RuleUtils.buildContext(participant, "participant"); context.addAssociatedContext(RuleUtils.buildContext(exp, "experiment")); final CvTerm method = exp.getInteractionDetectionMethod(); messages=mapping.check( method, role, context, this ); } } return messages; }
@Override public void writeParticipantAnnotations(ParticipantEvidence participant) throws IOException { if (participant != null){ Collection<Annotation> noExportAnnotations = AnnotationUtils.collectAllAnnotationsHavingTopic(participant.getInteractor().getAnnotations(), null, "no-export"); Collection<Annotation> exportAnnotations = new ArrayList<Annotation>(participant.getInteractor().getAnnotations()); exportAnnotations.removeAll(noExportAnnotations); Collection<Annotation> noExportAnnotations2 = AnnotationUtils.collectAllAnnotationsHavingTopic(participant.getAnnotations(), null, "no-export"); Collection<Annotation> exportAnnotations2 = new ArrayList<Annotation>(participant.getAnnotations()); exportAnnotations2.removeAll(noExportAnnotations2);
public void writeParticipantIdentificationMethod(ParticipantEvidence participant) throws IOException { if (participant != null){ if (!participant.getIdentificationMethods().isEmpty()){ Iterator<CvTerm> methodIterator = participant.getIdentificationMethods().iterator(); while(methodIterator.hasNext()){ writeCvTerm(methodIterator.next()); if (methodIterator.hasNext()){ getWriter().write(MitabUtils.FIELD_SEPARATOR); } } } else{ getWriter().write(MitabUtils.EMPTY_COLUMN); } } else { getWriter().write(MitabUtils.EMPTY_COLUMN); } }
target.setParticipantA(first); if (self){ ParticipantEvidence clone = new DefaultParticipantEvidence(first.getInteractor()); ParticipantCloner.copyAndOverrideParticipantEvidenceProperties(first, clone, true); clone.setInteraction(target); if (first.getStoichiometry() != null){ clone.setStoichiometry(0); ParticipantEvidence clone = new DefaultParticipantEvidence(first.getInteractor()); ParticipantCloner.copyAndOverrideParticipantEvidenceProperties(first, clone, true); target.setParticipantA(clone); clone.setInteraction(target); ParticipantEvidence clone2 = new DefaultParticipantEvidence(first.getInteractor()); ParticipantCloner.copyAndOverrideParticipantEvidenceProperties(first, clone2, true); clone2.setInteraction(target); if (first.getStoichiometry() != null){ clone2.setStoichiometry(0); ParticipantEvidence clone2 = new DefaultParticipantEvidence(second.getInteractor()); ParticipantCloner.copyAndOverrideParticipantEvidenceProperties(second, clone2, true); target.setParticipantB(clone2); clone2.setInteraction(target);
/** * For each experiment associated with this interaction, collect all respective participants and their biological roles and * check if the dependencies are correct. * * @param participant a participant to check on. * @return a collection of validator messages. * if we fail to retreive the MI Ontology. */ public Collection<ValidatorMessage> check( ParticipantEvidence participant ) throws ValidatorException { Collection<ValidatorMessage> messages = Collections.EMPTY_LIST; CvTerm biolRole = participant.getBiologicalRole(); if (participant.getInteraction() != null){ InteractionEvidence interaction = participant.getInteraction(); Experiment exp = interaction.getExperiment(); if (exp != null){ CvTerm method = exp.getInteractionDetectionMethod(); // build a context in case of error MiContext context = RuleUtils.buildContext(participant, "participant"); context.addAssociatedContext(RuleUtils.buildContext(exp, "experiment")); messages=mapping.check( method, biolRole, context, this ); } } return messages; }
String firstName = firstShortNameAlphabeticalOrder.getInteractor().getShortName().trim().toLowerCase(); String secondName = p.getInteractor().getShortName().trim().toLowerCase();
public void onExpressedInUpdate(T entity, Organism oldOrganism) { if (oldOrganism == null){ experimentalEntityChangeLogger.log(Level.INFO, "The expressed in organism has been initialised for the experimental entity " + entity.toString()); } else if (entity.getExpressedInOrganism() == null){ experimentalEntityChangeLogger.log(Level.INFO, "The expressed in organism has been reset for the experimental entity " + entity.toString()); } else { experimentalEntityChangeLogger.log(Level.INFO, "The expressed in organism " + oldOrganism + " has been updated with " + entity.getExpressedInOrganism() + " in the experimental entity " + entity.toString()); } }
public void onExperimentalRoleUpdate(T entity, CvTerm oldTerm) { experimentalEntityChangeLogger.log(Level.INFO, "The experimental role " + oldTerm + " has been updated with " + entity.getBiologicalRole() + " in the experimental entity " + entity.toString()); }
CvTerm expRoles1 = experimentalParticipant1.getExperimentalRole(); CvTerm expRoles2 = experimentalParticipant2.getExperimentalRole(); Collection<CvTerm> method1 = experimentalParticipant1.getIdentificationMethods(); Collection<CvTerm> method2 = experimentalParticipant2.getIdentificationMethods(); Collection<CvTerm> prep1 = experimentalParticipant1.getExperimentalPreparations(); Collection<CvTerm> prep2 = experimentalParticipant2.getExperimentalPreparations(); Organism organism1 = experimentalParticipant1.getExpressedInOrganism(); Organism organism2 = experimentalParticipant2.getExpressedInOrganism(); Collection<Parameter> param1 = experimentalParticipant1.getParameters(); Collection<Parameter> param2 = experimentalParticipant2.getParameters(); Collection<FeatureEvidence> features1 = experimentalParticipant1.getFeatures(); Collection<FeatureEvidence> features2 = experimentalParticipant2.getFeatures();
public void writeExperimentalRole(ParticipantEvidence participant) throws IOException { if (participant != null){ writeCvTerm(participant.getExperimentalRole()); } else { getWriter().write(MitabUtils.EMPTY_COLUMN); } }
/** * Method to know if a participant evidence has a putative self experimental or biological role * @param p * @return */ public static boolean isPutativeSelfParticipantEvidence(ParticipantEvidence p){ if (p == null){ return false; } CvTerm experimentalRole = p.getExperimentalRole(); CvTerm biologicalRole = p.getBiologicalRole(); return DefaultCvTermComparator.areEquals(CvTermUtils.getPutativeSelf(), experimentalRole) || DefaultCvTermComparator.areEquals(CvTermUtils.getPutativeSelf(), biologicalRole) ; }
/** * Make sure that a participant evidence has a valid Participant Identification Method that all the participant identification methods are valid. * * @param participant an interaction to check on. * @return a collection of validator messages. */ public Collection<ValidatorMessage> check( ParticipantEvidence participant ) throws ValidatorException { // list of messages to return Collection<ValidatorMessage> messages = Collections.EMPTY_LIST; if (participant.getIdentificationMethods().isEmpty()){ MiContext context = RuleUtils.buildContext(participant, "participant"); messages=Collections.singleton(new ValidatorMessage(" The participant does not have a participant identification method and it is required for MIMIx", MessageLevel.ERROR, context, this)); } return messages; }
ParticipantEvidence clone = new DefaultParticipantEvidence(p.getInteractor()); ParticipantCloner.copyAndOverrideParticipantEvidenceProperties(p, clone, true); target.addParticipant(clone);