/** * Gets the size of representable Controller of this Control. * * @param ctrl Control to check its controllers * @return size of representable controllers */ private Set<PhysicalEntity> getControllers(Control ctrl) { Set<PhysicalEntity> controllers = new HashSet<PhysicalEntity>(); for (Controller clr : ctrl.getController()) { if (clr instanceof PhysicalEntity && glyphMap.containsKey(convertID(clr.getUri()))) { controllers.add((PhysicalEntity) clr); } } return controllers; }
/** * Iterates the controller of ctrl and infers possible binary interactions. * @param ctrl to iterate controllers * @param interactionSet set to collect inferred interactions */ private void iterateControllers(Control ctrl, InteractionSetL3 interactionSet) { for (Controller pe : ctrl.getController()) { if (pe instanceof PhysicalEntity) { BioPAXElement owner = interactionSet.getGroupMap().getEntityReferenceOrGroup(pe); if (!current.equals(owner)) { createAndAdd(current, owner, interactionSet,CO_CONTROL); } } } }
/** * Checks if the controlled Interaction contains a controller as a participant. This constraint * filters out such cases. * @param match current pattern match * @param ind mapped indices * @return true if participants of teh controlled Interactions not also a controller of the * Control. */ @Override public boolean satisfies(Match match, int... ind) { Control ctrl = (Control) match.get(ind[0]); for (Process process : ctrl.getControlled()) { if (process instanceof Interaction) { Interaction inter = (Interaction) process; Set<Entity> participant = inter.getParticipant(); for (Controller controller : ctrl.getController()) { if (participant.contains(controller)) return false; } } } return true; } }
private org.opencb.bionetdb.core.models.Regulation createRegulation(BioPAXElement bioPAXElement) { org.opencb.bionetdb.core.models.Regulation regulation = new org.opencb.bionetdb.core.models.Regulation(); Control controlBP = (Control) bioPAXElement; // Common Interaction properties setInteractionCommonProperties(controlBP, regulation); // Regulation properties // controllers Set<Controller> controllers = controlBP.getController(); for (Controller controller: controllers) { regulation.getControllers().add(controller.getRDFId().split("#")[1]); } // controlled Set<Process> controlledProcesses = controlBP.getControlled(); for (Process controlledProcess: controlledProcesses) { regulation.getControlledProcesses().add(controlledProcess.getRDFId().split("#")[1]); } // controlType regulation.setControlType(controlBP.getControlType().toString()); return regulation; }
/** * Adds a BioPAX Control Interaction. */ private void addControlInteraction(CyNetwork network, Control control) { Collection<Process> controlledList = control.getControlled(); for (Process process : controlledList) { // Determine the BioPAX Edge Type String typeStr = "controlled"; //default ControlType cType = control.getControlType(); typeStr = (cType == null) ? typeStr : cType.toString(); //edge direction (trick) - from control to process (like for 'right', 'cofactor', 'participant') linkNodes(network, process, control, typeStr); } Collection<Controller> controllerList = control.getController(); for (Controller controller : controllerList) { // directed edge - from Controller to Control (like 'left') linkNodes(network, control, controller, "controller"); } // cofactor relationships if(control instanceof Catalysis) { Collection<PhysicalEntity> coFactorList = ((Catalysis) control).getCofactor(); for(PhysicalEntity cofactor : coFactorList) { // direction - from control to cofactor (like 'right', 'participant', 'controlled') linkNodes(network, control, cofactor, "cofactor"); } } }