/** * Searches pathways that contains this conversion for the possible directions. If both * directions exist, then the result is reversible. * @param conv the conversion * @return direction inferred from pathway membership */ protected ConversionDirectionType findDirectionInPathways(Conversion conv) { Set<StepDirection> dirs = new HashSet<StepDirection>(); for (PathwayStep step : conv.getStepProcessOf()) { if (step instanceof BiochemicalPathwayStep) { StepDirection dir = ((BiochemicalPathwayStep) step).getStepDirection(); if (dir != null) dirs.add(dir); } } if (dirs.size() > 1) return ConversionDirectionType.REVERSIBLE; else if (!dirs.isEmpty()) { return dirs.iterator().next() == StepDirection.LEFT_TO_RIGHT ? ConversionDirectionType.LEFT_TO_RIGHT : ConversionDirectionType.RIGHT_TO_LEFT; } else return null; }
/** * Gets the direction of the Control chain the the Interaction. * @param conv controlled conversion * @param pathway the container pathway * @return the direction of the conversion related to the catalysis */ protected ConversionDirectionType getDirection(Conversion conv, Pathway pathway) { Set<StepDirection> dirs = new HashSet<StepDirection>(); // find the direction in the pathway step for (PathwayStep step : conv.getStepProcessOf()) { if (step.getPathwayOrderOf().equals(pathway) && step instanceof BiochemicalPathwayStep) { StepDirection dir = ((BiochemicalPathwayStep) step).getStepDirection(); if (dir != null) dirs.add(dir); } } if (dirs.size() > 1) return ConversionDirectionType.REVERSIBLE; else if (!dirs.isEmpty()) return convertStepDirection(dirs.iterator().next()); return getDirection(conv); }
/** * Gets the direction of the Control chain the the Interaction. * @param conv controlled conversion * @param pathway the container pathway * @param cont top control * @return the direction of the conversion related to the catalysis */ protected ConversionDirectionType getDirection(Conversion conv, Pathway pathway, Control cont) { for (Control ctrl : getControlChain(cont, conv)) { ConversionDirectionType dir = getCatalysisDirection(ctrl); if (dir != null) return dir; } Set<StepDirection> dirs = new HashSet<StepDirection>(); Set<PathwayStep> convSteps = conv.getStepProcessOf(); // maybe the direction is embedded in a pathway step for (PathwayStep step : cont.getStepProcessOf()) { if (pathway != null && !step.getPathwayOrderOf().equals(pathway)) continue; if (step instanceof BiochemicalPathwayStep && convSteps.contains(step)) { StepDirection dir = ((BiochemicalPathwayStep) step).getStepDirection(); if (dir != null) dirs.add(dir); } } if (dirs.size() > 1) return ConversionDirectionType.REVERSIBLE; else if (!dirs.isEmpty()) return convertStepDirection(dirs.iterator().next()); return getDirection(conv); }