Пример #1
0
  public MetabolicReaction parseTwoSidedReaction(
      PreparsedReaction preparsed, String[] equationSides) throws UnparsableReactionError {

    Matcher reactionCompartment = REACTION_COMPARTMENT.matcher(equationSides[0]);

    MetabolicReaction rxn = getReaction(preparsed);

    Compartment defaultCompartment = Organelle.CYTOPLASM;

    if (reactionCompartment.find()) {
      defaultCompartment = resolver.getCompartment(reactionCompartment.group(1));
      equationSides[0] = reactionCompartment.replaceAll("");
    }

    for (MetabolicParticipantImplementation p :
        parseParticipants(equationSides[0], defaultCompartment, preparsed)) {
      rxn.addReactant(p);
    }
    for (MetabolicParticipantImplementation p :
        parseParticipants(equationSides[1], defaultCompartment, preparsed)) {
      rxn.addProduct(p);
    }

    return rxn;
  }
Пример #2
0
  /** Only have left side (or some weird reaction operator) */
  public MetabolicReaction parseExchangeReaction(PreparsedReaction reaction, String equationSide)
      throws UnparsableReactionError {
    Matcher reactionCompartment = REACTION_COMPARTMENT.matcher(equationSide);

    MetabolicReaction rxn = getReaction(reaction);

    Compartment defaultCompartment = Organelle.CYTOPLASM;

    if (reactionCompartment.find()) {
      defaultCompartment = resolver.getCompartment(reactionCompartment.group(1));
      equationSide = reactionCompartment.replaceAll("");
    }

    for (MetabolicParticipantImplementation p :
        parseParticipants(equationSide, defaultCompartment, reaction)) {
      rxn.addReactant(p);
    }

    return rxn;
  }