@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; }
if (interaction.getInteractionType() != null){ checkCv(messages, interaction.getInteractionType(), interaction, "interaction");
target.setNegative(source.isNegative()); target.setShortName(source.getShortName()); target.setInteractionType(source.getInteractionType()); target.setUpdatedDate(source.getUpdatedDate());
/** * 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; }