Examples of Reaction


Examples of org.sbml.jsbml.Reaction

  /**
   *
   */
  @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

Examples of org.sbml.jsbml.Reaction

   *
   */
  @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

Examples of org.sbml.jsbml.Reaction

    // 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

Examples of org.sbml.jsbml.Reaction

   *
   */
  @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

Examples of org.sbml.jsbml.Reaction

  /**
   *
   */
  @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

Examples of org.sbml.jsbml.Reaction

  /**
   *
   */
  @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

Examples of org.sbml.jsbml.Reaction

  /**
   *
   */
  @Test public void testRegister7() {
   
    Reaction r2 = model.createReaction("R2");
   
    r2.createReactant("SR3");
   
    r2.createKineticLaw().createLocalParameter("LP1");
   
    Reaction clonedR2 = r2.clone();

    assertTrue(clonedR2.getKineticLaw().getLocalParameterCount() == 1);

    try {
      clonedR2.getKineticLaw().createLocalParameter("LP1");
     
      fail("We should not be able to register twice the same id.");
    } catch (IllegalArgumentException e) {
      assertTrue(true);
      // success
    }

    try {
      clonedR2.getKineticLaw().createLocalParameter("LP2");
      assertTrue(true);
      // success     
    } catch (IllegalArgumentException e) {
      fail("We should be able to register a new local parameter on a cloned reaction.");
    }
   
    assertTrue(clonedR2.getKineticLaw().getLocalParameterCount() == 2);
  }
View Full Code Here

Examples of org.sbml.jsbml.Reaction

  /**
   *
   */
  @Test public void testRegister8() {
   
    Reaction r2 = model.createReaction("R2");
   
    KineticLaw kl = r2.createKineticLaw();

    ListOf<LocalParameter> listOfLP = new ListOf<LocalParameter>(2, 4);
    listOfLP.add(new LocalParameter("LP1"));
    listOfLP.add(new LocalParameter("LP2"));
    listOfLP.add(new LocalParameter("LP3"));
View Full Code Here

Examples of org.sbml.jsbml.Reaction

   *
   */
  @Test public void testUnRegister() {
   
   
    Reaction r1 = model.removeReaction("R1");
   
    assertTrue(model.getReaction("R1") == null);   
    assertTrue(model.getReaction(0) == null);
    assertTrue(model.findNamedSBase("SP1") == null);
    assertTrue(model.findNamedSBase("SP2") == null);
    // assertTrue(model.findNamedSBase("LP1") == null);
    assertTrue(doc.findSBase("SP1") == null);
    assertTrue(doc.findSBase("R1") == null);
    assertTrue(doc.findSBase("LP1") == null);
   
    Species s3 = new Species();
   
    // Setting the same id as a removed SpeciesReference
    s3.setId("SP1");

    // Setting the same metaid as a removed LocalParameter
    try {
      s3.setMetaId("LP1");
      assertTrue(true);
    } catch (IdentifierException e) {
      fail("We should be able to put any metaId to a Species not linked to a model.");
    }

    try {
      model.addSpecies(s3);
      assertTrue(true);
    } catch (IllegalArgumentException e) {
      fail("We should be able to register an id or metaid from a removed element.");
      // success
    }
   
    try {
      SpeciesReference reactant = r1.createReactant("S1");
      reactant.setMetaId("S1");
    } catch (IllegalArgumentException e) {
      fail("We should be able to put any id to an element removed from a model.");
    } catch (IdentifierException e) {
      fail("We should be able to put any id to an element removed from a model.");
View Full Code Here

Examples of org.sbml.jsbml.Reaction

  /**
   *
   */
  @Test public void testUnRegister2() {
   
    Reaction r1 = model.removeReaction("R1");

    assertTrue(r1.getReactant("SP1") != null);

    assertTrue(model.findNamedSBase("LP1") == null);
   
    // creating a product with the same id as a species
    r1.createProduct("S1");
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.