/** * Checks if the type of a Control is inhibition. * @param ctrl Control to check * @return true if type is inhibition related */ public boolean isInhibition(Control ctrl) { return ctrl.getControlType() != null && ctrl.getControlType().toString().startsWith("I"); }
/** * 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 void fix(Control t, Object... values) { if(t instanceof Catalysis) { ((Catalysis)t).setControlType(ControlType.ACTIVATION); } else if (t instanceof TemplateReactionRegulation){ if(values.length >0 && values[0] instanceof ControlType) { ControlType ct = (ControlType) values[0]; ((TemplateReactionRegulation)t).setControlType(ct); } else { ((TemplateReactionRegulation)t).setControlType(null); if(logger.isInfoEnabled()) logger.info(t.getUri() + " - invalid controlType value deleted"); } } else { logger.error("This does not auto-fix " + " controlType property of " + t.getModelInterface().getSimpleName()); } }
private String printControls(Map<Control, Boolean> dc) { StringBuilder ctString = new StringBuilder(); for (Control control : dc.keySet()) { Boolean direction = dc.get(control); ctString.append(direction ? "Lost activity:" : "Gained activity").append(":").append( control.getControlType()); for (Process process : control.getControlled()) { ctString.append(process.getName()).append(" ,"); } ctString.append("; "); } return ctString.toString(); }
private void fix(Control t, Object... values) { if(t instanceof Catalysis) { ((Catalysis)t).setControlType(ControlType.ACTIVATION); } else if (t instanceof TemplateReactionRegulation){ if(values.length >0 && values[0] instanceof ControlType) { ControlType ct = (ControlType) values[0]; ((TemplateReactionRegulation)t).setControlType(ct); } else { ((TemplateReactionRegulation)t).setControlType(null); if(logger.isInfoEnabled()) logger.info(t.getRDFId() + " - invalid controlType value deleted"); } } else { logger.error("This does not auto-fix " + " controlType property of " + t.getModelInterface().getSimpleName()); } }
/** * 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"); } } }
/** * 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; }
/** * Checks if the control chain is actually controlling the Interaction. * @param list the Control chain * @param inter target Interaction * @return true if the chain controls the Interaction */ private boolean search(LinkedList<Control> list, Interaction inter) { if (list.getLast().getControlled().contains(inter)) return true; for (Process process : list.getLast().getControlled()) { if (process instanceof Control) { // prevent searching in cycles if (list.contains(process)) continue; list.add((Control) process); if (search(list, inter)) return true; else list.removeLast(); } } return false; }
else if (controllers.size() == 1 && getControllerSize(ctrl.getControlledOf()) == 0) cg = getGlyphToLink(controllers.iterator().next(), convertID(ctrl.getUri())); Glyph gg = handlePEGroup(controllers, convertID(ctrl.getUri())); if(gg != null) toConnect.add(gg); for (Control ctrl2 : ctrl.getControlledOf()) Glyph g = handlePEGroup(cofs, convertID(ctrl.getUri())); if (g != null) toConnect.add(g);
writer.write(" " + ctrl.getUri());
/** * Iterates upward controls and initiates an upward search for each one. * @param ctrl to proceed upwards * @param interactionSet set to collect inferred interactions */ private void proceedUpwards(Control ctrl, InteractionSetL3 interactionSet) { for (Control cnt : ctrl.getControlledOf()) { searchUpwards(cnt, interactionSet); } }
interaction.getControlledBy().add(control.getRDFId().split("#")[1]);
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; }
BinaryInteractionType type = ctrl.getControlType() != null && ctrl.getControlType().toString().startsWith("I") ? BinaryInteractionType.DOWNREGULATE_EXPRESSION : BinaryInteractionType.UPREGULATE_EXPRESSION; for (Process process : ctrl.getControlled())
/** * 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); } } } }
/** * Creates a list of conversions on which this control has an effect. If the * control controls another control, then it is traversed recursively to find * the affected conversions. * @param cont control * @param convList list of affected conversions * @return list of affected conversions */ private List<Conversion> getAffectedConversions(Control cont, List<Conversion> convList) { if (convList == null) { convList = new ArrayList<Conversion>(); } for (Process prcss : cont.getControlled()) { if (prcss instanceof Conversion) { convList.add((Conversion) prcss); } else if (prcss instanceof Control) { getAffectedConversions((Control) prcss, convList); } } return convList; }
/** * Identifies negative and positive controls. Assumes positive by default. * @param ctrl control to check * @return sign */ protected int sign(Control ctrl) { ControlType type = ctrl.getControlType(); if (type != null && type.name().startsWith("I")) return -1; return 1; }
/** * Iterates downwards processes, initiates a downwards search of controls and * upwards search of controls and conversions. * @param ctrl to look downward * @param interactionSet set to collect inferred interactions */ private void proceedDownwards(Control ctrl, InteractionSetL3 interactionSet) { // Iterate each controlled process for (Process prcss : ctrl.getControlled()) { // Search downwards of controls if (prcss instanceof Control) { searchDownwards((Control) prcss, interactionSet); } // Search other upwards control trees of all processes (controls and conversions) for (Control cnt : prcss.getControlledOf()) { if (cnt != ctrl) // Do not go where we came from { searchUpwards(cnt, interactionSet); } } } }
ControlType type = ctrl.getControlType(); if (type == null)
public void check(Control thing, boolean fix) { if(thing.getControlType() != null)