Example #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;
  }
Example #2
0
  @Test
  public void testAddReactant_Metabolite() throws Exception {
    MetabolicReaction mock = mock(MetabolicReaction.class);
    MetabolicReaction rxn = new BiochemRxnImpl(mock);

    Metabolite m = mock(Metabolite.class);
    rxn.addReactant(m);
    verify(mock).addReactant(m);
  }
Example #3
0
  @Test
  public void testAddReactant() throws Exception {
    MetabolicReaction mock = mock(MetabolicReaction.class);
    MetabolicReaction rxn = new BiochemRxnImpl(mock);

    MetabolicParticipant p = mock(MetabolicParticipant.class);

    rxn.addReactant(p);
    verify(mock).addReactant(p);
  }
Example #4
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;
  }