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.getXrefs().clear(); target.getXrefs().addAll(source.getXrefs()); target.getAliases().clear(); target.getAliases().addAll(source.getAliases()); target.setInteractor(source.getInteractor()); target.getFeatures().clear(); target.addAllFeatures(source.getFeatures()); target.getFeatures().clear(); for (Object f : source.getFeatures()){ Feature clone = new DefaultFeature(); FeatureCloner.copyAndOverrideBasicFeaturesProperties((Feature)f, clone); target.addFeature(clone);
public boolean removeAll(Collection<?> objects) { boolean remove = candidates.removeAll(objects); if (remove){ Collection<Interactor> interactors = new ArrayList<Interactor>(objects.size()); for (Object o : objects){ Participant entity = (Participant)o; entity.setChangeListener(null); interactors.add(entity.getInteractor()); entity.setInteraction(null); } // check if an interactor is not in another entity that is kept. // remove any interactors that are kept with other entities for (P entity : this){ interactors.remove(entity.getInteractor()); } getInteractor().removeAll(interactors); } return remove; }
if (object.getInteractor() instanceof Complex){ Interactor interactor = object.getInteractor(); Interactor interactor = object.getInteractor(); getStoichiometryWriter().write(object.getStoichiometry()); getCvWriter().write(object.getBiologicalRole()); if (!object.getFeatures().isEmpty()){ writeAllFeatures(object.getFeatures());
public boolean retainAll(Collection<?> objects) { boolean retain = candidates.retainAll(objects); if (retain){ Collection<Interactor> interactors = new ArrayList<Interactor>(objects.size()); for (Object o : objects){ interactors.add(((Participant)o).getInteractor()); } getInteractor().retainAll(interactors); } return retain; }
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()); }
Interactor interactor = participant.getInteractor(); if (!participant.getAliases().isEmpty()){ Iterator<Alias> aliasIterator = participant.getAliases().iterator();
target.setParticipantA(first); if (self){ Participant clone = new DefaultParticipant(first.getInteractor()); ParticipantCloner.copyAndOverrideBasicParticipantProperties(first, clone, true); if (first.getStoichiometry() != null){ clone.setStoichiometry(0); Participant clone = new DefaultParticipant(first.getInteractor()); ParticipantCloner.copyAndOverrideBasicParticipantProperties(first, clone, true); target.setParticipantA(clone); Participant clone2 = new DefaultParticipant(first.getInteractor()); ParticipantCloner.copyAndOverrideBasicParticipantProperties(first, clone2, true); if (first.getStoichiometry() != null){ clone2.setStoichiometry(0); Participant clone2 = new DefaultParticipant(second.getInteractor()); ParticipantCloner.copyAndOverrideBasicParticipantProperties(second, clone2, true); target.setParticipantB(clone2);
public void writeParticipantAnnotations(P participant) throws IOException { if (participant != null){ if (!participant.getInteractor().getAnnotations().isEmpty()){ Iterator<Annotation> interactorAnnotationIterator = participant.getInteractor().getAnnotations().iterator(); if (!participant.getAnnotations().isEmpty()){ getWriter().write(MitabUtils.FIELD_SEPARATOR); Iterator<Annotation> participantAnnotationIterator = participant.getAnnotations().iterator(); else if (!participant.getAnnotations().isEmpty()){ Iterator<Annotation> participantAnnotationIterator = participant.getAnnotations().iterator();
if (!participant.getInteractor().getXrefs().isEmpty()){ Iterator<Xref> interactorXrefIterator = participant.getInteractor().getXrefs().iterator(); if (!participant.getXrefs().isEmpty()){ getWriter().write(MitabUtils.FIELD_SEPARATOR); Iterator<Xref> participantXrefIterator = participant.getXrefs().iterator(); while (participantXrefIterator.hasNext()) { Xref ref = participantXrefIterator.next(); if (participant.getInteractor() instanceof InteractorPool){ InteractorPool interactorPool = (InteractorPool)participant.getInteractor(); Iterator<Interactor> interactorIterator = interactorPool.iterator(); while (interactorIterator.hasNext()){ else if (!participant.getXrefs().isEmpty()){ Iterator<Xref> participantXrefIterator = participant.getXrefs().iterator(); while (participantXrefIterator.hasNext()) { Xref ref = participantXrefIterator.next(); if (participant.getInteractor() instanceof InteractorPool){ InteractorPool interactorPool = (InteractorPool)participant.getInteractor(); Iterator<Interactor> interactorIterator = interactorPool.iterator(); while (interactorIterator.hasNext()){ else if (participant.getInteractor() instanceof InteractorPool){ InteractorPool interactorPool = (InteractorPool)participant.getInteractor(); Iterator<Interactor> interactorIterator = interactorPool.iterator(); boolean first = true;
public void onStoichiometryUpdate(T entity, Stoichiometry oldStoichiometry) { if (oldStoichiometry == null){ entityChangeLogger.log(Level.INFO, "The stoichiometry has been initialised for the entity " + entity.toString()); } else if (entity.getStoichiometry() == null){ entityChangeLogger.log(Level.INFO, "The stoichiometry has been reset for the entity " + entity.toString()); } else { entityChangeLogger.log(Level.INFO, "The stoichiometry " + oldStoichiometry + " has been updated with " + entity.getStoichiometry() + " in the entity " + entity.toString()); } }
public void writeParticipantFeatures(P participant) throws IOException { if (participant != null){ if (!participant.getFeatures().isEmpty()){ Iterator<? extends Feature> featureIterator = participant.getFeatures().iterator(); while(featureIterator.hasNext()){ writeFeature(featureIterator.next()); if (featureIterator.hasNext()){ getWriter().write(MitabUtils.FIELD_SEPARATOR); } } } else{ getWriter().write(MitabUtils.EMPTY_COLUMN); } } else { getWriter().write(MitabUtils.EMPTY_COLUMN); } }
public void writeInteractorOrganism(P participant) throws IOException { if (participant != null){ Interactor interactor = participant.getInteractor(); writeOrganism(interactor.getOrganism()); } else{ writer.write(MitabUtils.EMPTY_COLUMN); } }
CvTerm role1 = participant1.getBiologicalRole(); CvTerm role2 = participant2.getBiologicalRole();
Interactor interactor = component.getInteractor(); if (interactor == null){ throw new IllegalArgumentException("The component must have a non null interactor."); for (Object alias : component.getAliases()) { if (AliasUtils.doesAliasHaveType((Alias)alias, Alias.AUTHOR_ASSIGNED_NAME_MI, Alias.AUTHOR_ASSIGNED_NAME)) { this.authorAssignedName = ((Alias)alias).getName();
/** * Use DefaultExactParticipantBaseComparator 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 { if (!DefaultExactEntityBaseComparator.areEquals(participant1, participant2, ignoreInteractors)){ return false; } // then compares the stoichiometry Stoichiometry stc1 = participant1.getStoichiometry(); Stoichiometry stc2 = participant2.getStoichiometry(); return StoichiometryComparator.areEquals(stc1, stc2); } } }
private void collectFeaturesAndAddToGraph(I interaction, Graph<F, BindingPair<F>> graph) { for (Object o : interaction.getParticipants()){ Participant participant = (Participant)o; for (Object o2 : participant.getFeatures()){ F feature = (F)o2; if (!feature.getLinkedFeatures().isEmpty()){ graph.addVertex(feature); for (Object o3 : feature.getLinkedFeatures()){ F feature2 = (F)o3; graph.addVertex(feature2); graph.addEdge(feature, feature2); } } } } } }
public void writeUniqueIdentifier(P participant) throws IOException { if (participant == null){ writer.write(MitabUtils.EMPTY_COLUMN); } else { Interactor interactor = participant.getInteractor(); // write first identifier if (!interactor.getIdentifiers().isEmpty()){ writeIdentifier(interactor.getPreferredIdentifier()); } else{ writer.write(MitabUtils.EMPTY_COLUMN); } } }
public void writeBiologicalRole(P participant) throws IOException { if (participant != null){ writeCvTerm(participant.getBiologicalRole()); } else { getWriter().write(MitabUtils.EMPTY_COLUMN); } }
public void writeParticipantStoichiometry(P participant) throws IOException { if (participant != null){ if (participant.getStoichiometry() != null){ Stoichiometry stc = participant.getStoichiometry(); // same stoichiometry max/end if (stc.getMaxValue() == stc.getMinValue()){ getWriter().write(Long.toString(stc.getMinValue())); } else{ getWriter().write(Long.toString(stc.getMinValue())); getWriter().write("-"); getWriter().write(Long.toString(stc.getMaxValue())); } } else{ getWriter().write(MitabUtils.EMPTY_COLUMN); } } else { getWriter().write(MitabUtils.EMPTY_COLUMN); } }
public void writeParticipantChecksums(P participant) throws IOException { if (participant != null){ if (!participant.getInteractor().getChecksums().isEmpty()){ Iterator<Checksum> checksumIterator = participant.getInteractor().getChecksums().iterator(); while(checksumIterator.hasNext()){ writeChecksum(checksumIterator.next()); if (checksumIterator.hasNext()){ getWriter().write(MitabUtils.FIELD_SEPARATOR); } } } else{ getWriter().write(MitabUtils.EMPTY_COLUMN); } } else { getWriter().write(MitabUtils.EMPTY_COLUMN); } }