Package org.sbml.jsbml

Examples of org.sbml.jsbml.Reaction


  /**
   * Test method for {@link org.sbml.jsbml.Model#removeReaction(java.lang.String)}.
   */
  @Test
  public void testRemoveReactionString() {
    Reaction r = modelL3.createReaction("r1");
    assertTrue(modelL3.getReaction(r.getId()) != null);

    modelL3.removeReaction(r.getId());
    assertTrue(modelL3.getReaction(r.getId()) == null);
  }
View Full Code Here


      }
    }
  }
 
  public void generateEdgesForReactionGlyph(ReactionGlyph rGlyph){
    Reaction reaction = getReactionForReactionGlyph(rGlyph);   
    if (reaction != null){
      List<String[]> connectedSpecies = getConnectedSpecies(reaction);
      for (String[] data: connectedSpecies){
        String speciesId = data[0];
        String role = data[1];
View Full Code Here

  public Reaction getReactionForReactionGlyph(ReactionGlyph rGlyph) {
    if (!rGlyph.isSetReaction()){
      return null;
    }
    String reactionId = rGlyph.getReaction();
    Reaction reaction = null;
    if (model.isSetListOfReactions()) {
      for (Reaction r : model.getListOfReactions()) {
        if (r.getId().equals(reactionId)) {
          reaction = r;
          break;
View Full Code Here

    s1.setMetaId("S1");
   
    Species s2 = model.createSpecies("S2", comp);
    s2.setMetaId("S2");
   
    Reaction r1 = model.createReaction("R1");
    r1.setMetaId("R1");
   
    SpeciesReference reactant = model.createReactant("SP1");
    reactant.setMetaId("SP1");
    reactant.setSpecies(s1);
   
    SpeciesReference product = model.createProduct("SP2");
    product.setMetaId("SP2");
    product.setSpecies(s2);
   
    LocalParameter lp1 = r1.createKineticLaw().createLocalParameter("LP1");
    lp1.setMetaId("LP1");
   
  }
View Full Code Here

  /**
   *
   */
  @Test public void testRegister3() {
   
    Reaction r2 = new Reaction(2,4);
    r2.setId("R2");
    KineticLaw k = r2.createKineticLaw();
   
    k.createLocalParameter("LP1");
   
    // We should not be allowed to register an other local parameter with the same id
    try {
View Full Code Here

   *
   */
  @Test public void testRegister3_1() {
   
    // Creating a new reaction without id
    Reaction r2 = model.createReaction();

    assertTrue(model.getReactionCount() == 2);

    KineticLaw k = r2.createKineticLaw();
   
    k.createLocalParameter("LP1");
   
    k.getLocalParameter("LP1").setMetaId("LP1_2");
    k.getLocalParameter(0).setName("LP1_2");
   
    assertTrue(k.getLocalParameterCount() == 1);
   
    assertTrue(model.findLocalParameters("LP1").size() == 2);
    assertTrue(model.findReactionsForLocalParameter("LP1").size() == 1);
   
    r2.setId("R2");
   
    assertTrue(model.findReactionsForLocalParameter("LP1").size() == 2);
   
    assertTrue(doc.findSBase("LP1_2") != null);
 
    r2.unsetKineticLaw();

    assertTrue(doc.findSBase("LP1_2") == null);

    assertTrue(model.findLocalParameters("LP1").size() == 1);
   
View Full Code Here

    // Using a List instead of a Set to store the Reaction associated with a local Parameter as
    // if the object HashCode change, it is not possible anymore to remove the element !!!
   
    // http://stackoverflow.com/questions/254441/hashset-remove-and-iterator-remove-not-working

    Reaction r2 = model.createReaction("R2");
    Reaction r3 = model.createReaction("R3");
   
    HashSet<Reaction> reactionSet = new HashSet<Reaction>();
   
    reactionSet.add(r2);
    reactionSet.add(r3);
View Full Code Here

   *
   */
  @Test public void testRegister3_3() {
   
    // Creating a new reaction without id
    Reaction r2 = model.createReaction();

    assertTrue(model.getReactionCount() == 2);

    KineticLaw k = r2.createKineticLaw();
   
    // Creating a new local parameter without id
    LocalParameter lp = k.createLocalParameter();
   
    lp.setMetaId("LP1_2");
    lp.setName("LP1_2");
    lp.setId("LP1");
   
    assertTrue(k.getLocalParameterCount() == 1);
   
    assertTrue(doc.findSBase("LP1_2") != null);

    assertTrue(k.getLocalParameter("LP1") != null);
    assertTrue(model.findLocalParameters("LP1").size() == 2);
    assertTrue(model.findReactionsForLocalParameter("LP1").size() == 1); // because r2 has no ID yet !!
   
    lp.setId("LP1_2"); // changing the id of the localParameter !!
   
    assertTrue(k.getLocalParameter("LP1") == null);
    assertTrue(k.getLocalParameter("LP1_2") != null);
   
    assertTrue(model.findLocalParameters("LP1_2").size() == 1);
   
    assertTrue(model.findLocalParameters("LP1").size() == 1);
   
    assertTrue(model.findReactionsForLocalParameter("LP1_2").size() == 0)// because r2 has no ID yet !!

    r2.setId("R2");
   
    assertTrue(model.findReactionsForLocalParameter("LP1_2").size() == 1);
    assertTrue(model.findReactionsForLocalParameter("LP1").size() == 1);
   
    assertTrue(doc.findSBase("LP1_2") != null);
    assertTrue(model.getReaction("R2") != null);
    assertTrue(model.findNamedSBase("R2") != null);
   
    r2.unsetKineticLaw();

    assertTrue(doc.findSBase("LP1_2") == null);

    assertTrue(model.findLocalParameters("LP1_2").size() == 0);
   
View Full Code Here

  /**
   *
   */
  @Test public void testRegister5_2() {
   
    Reaction r2 = new Reaction();
    r2.setId("R2");
   
    // Setting the same id as an existing Species   
    r2.createReactant("S1");
   
    try {
      model.addReaction(r2);
     
      fail("We should not be able to register twice the same id.");
View Full Code Here

  /**
   *
   */
  @Test public void testRegister5_3() {
   
    Reaction r2 = new Reaction();
    r2.setId("R2");
   
    // Setting the same id as an existing Species   
    r2.createReactant("S1");
   
    // Setting the parent by hand !!  // TODO: should we limit the access of SBase.setParentSBML and TreeNode.setParent (should be possible) ??   
    // r2.setParentSBML(new ListOf<Reaction>(2, 4));
    // r2.getParent().setParentSBML(model); // This will make the registration of the reaction non recursive
   
View Full Code Here

TOP

Related Classes of org.sbml.jsbml.Reaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.