public void onBiologicalRoleUpdate(T entity, CvTerm oldTerm) { entityChangeLogger.log(Level.INFO, "The biological role " + oldTerm + " has been updated with " + entity.getBiologicalRole() + " in the entity " + entity.toString()); }
CvTerm role1 = participant1.getBiologicalRole(); CvTerm role2 = participant2.getBiologicalRole();
public void writeBiologicalRole(P participant) throws IOException { if (participant != null){ writeCvTerm(participant.getBiologicalRole()); } else { getWriter().write(MitabUtils.EMPTY_COLUMN); } }
/** * Use DefaultParticipantBaseComparator to know if two participants are equals. * @param participant1 * @param participant2 * @return true if the two participants are equal */ public static boolean areEquals(Participant participant1, Participant participant2, boolean ignoreInteractors){ if (participant1 == participant2){ return true; } else if (participant1 == null || participant2 == null){ return false; } else { int comp; // first compares interactors if (!DefaultEntityBaseComparator.areEquals(participant1, participant2, ignoreInteractors)){ return false; } // then compares the biological role CvTerm role1 = participant1.getBiologicalRole(); CvTerm role2 = participant2.getBiologicalRole(); return DefaultCvTermComparator.areEquals(role1, role2); } } }
/** * To know if the participant does have a specific biological role * @param participant * @param roleId * @param roleName * @return true if the participant has the biological role with given name/identifier */ public static boolean doesParticipantHaveBiologicalRole(Participant participant, String roleId, String roleName){ if (participant == null || (roleName == null && roleId == null)){ return false; } CvTerm role = participant.getBiologicalRole(); // we can compare identifiers if (roleId != null && role.getMIIdentifier() != null){ // we have the same topic id return role.getMIIdentifier().equals(roleId); } // we need to compare topic names else if (roleName != null) { return roleName.equalsIgnoreCase(role.getShortName()); } return false; }
/** * * @param participant * @return the hashcode consistent with the equals method for this comparator */ public static int hashCode(Participant participant){ if (unambiguousParticipantComparator == null){ unambiguousParticipantComparator = new UnambiguousParticipantBaseComparator(); } if (participant == null){ return 0; } int hashcode = 31; hashcode = 31*hashcode + UnambiguousEntityBaseComparator.hashCode(participant); hashcode = 31*hashcode + UnambiguousCvTermComparator.hashCode(participant.getBiologicalRole()); return hashcode; } }
/** * * @param participant * @return the hashcode consistent with the equals method for this comparator */ public static int hashCode(Participant participant){ if (unambiguousExactParticipantComparator == null){ unambiguousExactParticipantComparator = new UnambiguousExactParticipantBaseComparator(); } if (participant == null){ return 0; } int hashcode = 31; hashcode = 31*hashcode + UnambiguousExactEntityBaseComparator.hashCode(participant); hashcode = 31*hashcode + UnambiguousCvTermComparator.hashCode(participant.getBiologicalRole()); return hashcode; } }
if (targetMi.contains(component.getBiologicalRole() .getMIIdentifier())) { sentence.addInteractorObject(component); } else if (enzymeMi.contains(component .getBiologicalRole().getMIIdentifier())) { sentence.addInteractorSubject(component);
/** * Method to know if a participant has a putative self biological role. * If checkParticipantEvidence is set to true, it will check if the given p is a ParticipantEvidence and look at the experimental role * @param p * @param checkParticipantEvidence * @return */ public static boolean isPutativeSelfParticipant(Participant p, boolean checkParticipantEvidence){ if (p == null){ return false; } CvTerm biologicalRole = p.getBiologicalRole(); if (DefaultCvTermComparator.areEquals(CvTermUtils.getPutativeSelf(), biologicalRole)){ return true; } if (checkParticipantEvidence){ if (p instanceof ParticipantEvidence){ CvTerm expRole = ((ParticipantEvidence)p).getExperimentalRole(); return DefaultCvTermComparator.areEquals(CvTermUtils.getPutativeSelf(), expRole) ; } } return false; }
/** * Method to know if a participant has a self biological role * If checkParticipantEvidence is set to true, it will check if the given p is a ParticipantEvidence and look at the experimental role * @param p * @param checkParticipantEvidence * @return */ public static boolean isSelfParticipant(Participant p, boolean checkParticipantEvidence){ if (p == null){ return false; } CvTerm biologicalRole = p.getBiologicalRole(); if (DefaultCvTermComparator.areEquals(CvTermUtils.getSelf(), biologicalRole)){ return true; } if (checkParticipantEvidence){ if (p instanceof ParticipantEvidence){ CvTerm expRole = ((ParticipantEvidence)p).getExperimentalRole(); return DefaultCvTermComparator.areEquals(CvTermUtils.getSelf(), expRole) ; } } return false; }
target.setBiologicalRole(source.getBiologicalRole()); target.setStoichiometry(source.getStoichiometry());
getCvWriter().write(object.getBiologicalRole());