target.setAvailability(source.getAvailability()); target.setExperiment(source.getExperiment()); target.setInferred(source.isInferred()); target.setCreatedDate(source.getCreatedDate()); target.setNegative(source.isNegative()); target.setShortName(source.getShortName()); target.setInteractionType(source.getInteractionType()); target.setUpdatedDate(source.getUpdatedDate()); target.getAnnotations().clear(); target.getAnnotations().addAll(source.getAnnotations()); target.getChecksums().clear(); target.getChecksums().addAll(source.getChecksums()); target.getConfidences().clear(); target.getConfidences().addAll(source.getConfidences()); target.getXrefs().clear(); target.getXrefs().addAll(source.getXrefs()); target.getIdentifiers().clear(); target.getIdentifiers().addAll(source.getIdentifiers()); target.getParameters().clear(); target.getParameters().addAll(source.getParameters()); target.getVariableParameterValues().clear(); target.getVariableParameterValues().addAll(source.getVariableParameterValues()); target.getParticipants().clear(); target.getParticipants().addAll(source.getParticipants()); for (ParticipantEvidence p : source.getParticipants()){
String imex1 = experimentalInteraction1.getImexId(); String imex2 = experimentalInteraction2.getImexId(); boolean isNegative1 = experimentalInteraction1.isNegative(); boolean isNegative2 = experimentalInteraction2.isNegative(); Experiment exp1 = experimentalInteraction1.getExperiment(); Experiment exp2 = experimentalInteraction2.getExperiment(); Collection<ParticipantEvidence> participants1 = experimentalInteraction1.getParticipants(); Collection<ParticipantEvidence> participants2 = experimentalInteraction2.getParticipants(); Collection<Parameter> parameters1 = experimentalInteraction1.getParameters(); Collection<Parameter> parameters2 = experimentalInteraction2.getParameters(); Collection<VariableParameterValueSet> parameterSet1 = experimentalInteraction1.getVariableParameterValues(); Collection<VariableParameterValueSet> parameterSet2 = experimentalInteraction2.getVariableParameterValues(); boolean inferred1 = experimentalInteraction1.isInferred(); boolean inferred2 = experimentalInteraction2.isInferred();
@Override protected void writeAllIdentifiers(I object) throws IOException { super.writeAllIdentifiers(object); if (object.getImexId() != null && object.getIdentifiers().isEmpty()){ Collection<Xref> imexIds = XrefUtils.collectAllXrefsHavingDatabaseAndId(object.getXrefs(), Xref.IMEX_MI, Xref.IMEX, object.getImexId()); if (!imexIds.isEmpty()){ MIJsonUtils.writeSeparator(getWriter()); getIdentifierWriter().write(imexIds.iterator().next()); } } }
@Override protected void writeOtherIdentifiers(I object) throws IOException { if (object.getImexId() != null){ Collection<Xref> imexIds = XrefUtils.collectAllXrefsHavingDatabaseAndId(object.getXrefs(), Xref.IMEX_MI, Xref.IMEX, object.getImexId()); if (!imexIds.isEmpty()){ MIJsonUtils.writeSeparator(getWriter()); getIdentifierWriter().write(imexIds.iterator().next()); } } }
Experiment exp = interaction.getExperiment(); if (exp != null && this.processObjects.add(exp)){ checkExperiment(messages, exp); if (interaction.getInteractionType() != null){ checkCv(messages, interaction.getInteractionType(), interaction, "interaction"); for (ParticipantEvidence p : interaction.getParticipants()){ checkParticipant(messages, p, interaction); for (Confidence c : interaction.getConfidences()){ checkConfidence(messages, c, interaction, "interaction"); for (Parameter p : interaction.getParameters()){ checkParameter(messages, p, interaction, "interaction"); for (Xref ref : interaction.getIdentifiers()){ checkXref(messages, ref, interaction, "interaction"); for (Xref ref : interaction.getXrefs()){ checkXref(messages, ref, interaction, "interaction"); for (Annotation a : interaction.getAnnotations()){ checkAnnotation(messages, a, interaction, "interaction"); for (Checksum a : interaction.getChecksums()){ checkChecksum(messages, a, interaction, "interaction");
interaction.setExperimentAndAddInteractionEvidence(createExperimentFrom(publication, detMethod, host)); interaction.setInteractionType(interactionType.iterator().next()); interaction.setInteractionType(interactionType.iterator().next()); interaction.getConfidences().addAll(conf); interaction.getXrefs().addAll(xrefI); interaction.getParameters().addAll(params); interaction.setCreatedDate(created.iterator().next().getDate()); interaction.setCreatedDate(created.iterator().next().getDate()); interaction.setUpdatedDate(update.iterator().next().getDate()); interaction.setUpdatedDate(update.iterator().next().getDate()); interaction.getChecksums().addAll(checksumI); interaction.setNegative(isNegative); interaction.addParticipant(A); interaction.addParticipant(B);
final Collection<Annotation> atts = AnnotationUtils.collectAllAnnotationsHavingTopic(interaction.getAnnotations(), AUTHOR_CONFIDENCE_MI_REF, AUTHOR_CONFIDENCE); if (interaction.getExperiment() != null) { final Collection<Annotation> expAtts = AnnotationUtils.collectAllAnnotationsHavingTopic( interaction.getExperiment().getAnnotations(), CONFIDENCE_MAPPING_MI_REF, CONFIDENCE_MAPPING); final Collection<Confidence> confs = ConfidenceUtils.collectAllConfidencesHavingType(interaction.getConfidences(), Confidence.AUTHOR_BASED_CONFIDENCE_MI, "author score"); if( interaction.getExperiment() != null) { final Collection<Annotation> expAtts = AnnotationUtils.collectAllAnnotationsHavingTopic( interaction.getExperiment().getAnnotations(), CONFIDENCE_MAPPING_MI_REF, CONFIDENCE_MAPPING);
@Override protected CvTerm extractInteractionDetectionMethodFrom(InteractionEvidence interaction) { return interaction.getExperiment() != null ? interaction.getExperiment().getInteractionDetectionMethod() : null; } }
protected void initialiseInteractionAnnotations(Collection<MitabAnnotation> annots, T interaction){ Iterator<MitabAnnotation> annotsIterator = annots.iterator(); while (annotsIterator.hasNext()){ MitabAnnotation annot = annotsIterator.next(); // add curation depth if (AnnotationUtils.doesAnnotationHaveTopic(annot, Annotation.IMEX_CURATION_MI, Annotation.IMEX_CURATION)){ interaction.getExperiment().getPublication().setCurationDepth(CurationDepth.IMEx); } else if (AnnotationUtils.doesAnnotationHaveTopic(annot, Annotation.MIMIX_CURATION_MI, Annotation.MIMIX_CURATION)){ interaction.getExperiment().getPublication().setCurationDepth(CurationDepth.MIMIx); } else if (AnnotationUtils.doesAnnotationHaveTopic(annot, Annotation.RAPID_CURATION_MI, Annotation.RAPID_CURATION)){ interaction.getExperiment().getPublication().setCurationDepth(CurationDepth.rapid_curation); } else{ interaction.getAnnotations().add(annot); } } }
/** * 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; }
/** * Make sure that an interaction has a valid IMEX id in its xref. * * @param interaction an interaction to check on. * @return a collection of validator messages. */ public Collection<ValidatorMessage> check( InteractionEvidence interaction ) throws ValidatorException { // Check xRef return PublicationRuleUtils.checkImexInteractionId(interaction.getImexId(), interaction, this); }
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()); Iterator<Parameter> paramIterator = object.getParameters().iterator(); while (paramIterator.hasNext()) { getParameterWriter().write(paramIterator.next());
public Collection<Confidence> getConfidences() { return getWrappedInteraction().getConfidences(); }
public Collection<Parameter> getParameters() { return getWrappedInteraction().getParameters(); }
@Override public Collection<ValidatorMessage> check(InteractionEvidence interaction) throws ValidatorException { Collection<ValidatorMessage> messages = Collections.EMPTY_LIST; if (!interaction.getAnnotations().isEmpty()){ Collection<Annotation> attributes = interaction.getAnnotations(); if (AnnotationUtils.collectAllAnnotationsHavingTopic(attributes, Annotation.FIGURE_LEGEND_MI, Annotation.FIGURE_LEGEND).isEmpty()){ MiContext context = RuleUtils.buildContext(interaction, "interaction"); messages=Collections.singleton( new ValidatorMessage( "Interaction with "+attributes.size()+" annotations but without a figure legend. A figure legend is recommended by IMEx.'", MessageLevel.WARN, context, this ) ); } } else { MiContext context = RuleUtils.buildContext(interaction, "interaction"); messages=Collections.singleton(new ValidatorMessage("Interaction without a figure legend. A figure legend is recommended by IMEx.'", MessageLevel.WARN, context, this)); } return messages; }
if( interaction.getIdentifiers().isEmpty() ) { MiContext context = RuleUtils.buildContext(interaction, "interaction"); messages=Collections.singletonList( new ValidatorMessage( "An interaction requires an identity cross reference to an interaction database (child term of "+ INTERACTION_DATABASE_MI_REF +")." , final Set<String> interactionDbs = collectNames(dbTerms); final Collection<Xref> dbRefs = XrefUtils.searchAllXrefsHavingDatabases(interaction.getIdentifiers(), interactionDbMis, interactionDbs); if( dbRefs.isEmpty() ) { MiContext context = RuleUtils.buildContext(interaction, "interaction"); String dbList = buildDbList( interaction.getIdentifiers() ); String msg = null; if( dbList.length() > 0 ) {
@Override public Collection<ValidatorMessage> check(InteractionEvidence interaction) throws ValidatorException { List<ValidatorMessage> messages = Collections.EMPTY_LIST; if (interaction.getInteractionType() == null){ MiContext context = RuleUtils.buildContext(interaction, "interaction"); messages=Collections.singletonList( new ValidatorMessage( "The interaction does not have an interaction type. At least one interaction type is required by IMEx.'", MessageLevel.ERROR, context, this ) ); } return messages; }
public void onExperimentUpdate(InteractionEvidence interaction, Experiment oldExperiment) { if (oldExperiment == null){ interactionEvidenceChangeLogger.log(Level.INFO, "The experiment has been initialised for the interaction " + interaction.toString()); } else if (interaction.getExperiment() == null){ interactionEvidenceChangeLogger.log(Level.INFO, "The experiment has been reset for the interaction " + interaction.toString()); } else { interactionEvidenceChangeLogger.log(Level.INFO, "The experiment " + oldExperiment + " has been updated with " + interaction.getExperiment() + " in the interaction " + interaction.toString()); } }
public void write(InteractionEvidence object) throws IOException { Collection<Annotation> figures = AnnotationUtils.collectAllAnnotationsHavingTopic(object.getAnnotations(), Annotation.FIGURE_LEGEND_MI, Annotation.FIGURE_LEGEND); Experiment experiment = object.getExperiment(); if (experiment != null){ MIJsonUtils.writeSeparator(this.writer);
@Override protected boolean hasIdentifiers(I object) { return super.hasIdentifiers(object) || object.getImexId() != null; } }