getNumReactions() public method

public getNumReactions ( ) : long
return long
Ejemplo n.º 1
0
 public void test_Model_addReaction5()
 {
     Model m = new  Model(2,2);
       Reaction r = new  Reaction(2,2);
       r.setId( "r");
       Reaction r1 = new  Reaction(2,2);
       r1.setId( "r");
       int i = m.addReaction(r);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumReactions() == 1 );
       i = m.addReaction(r1);
       assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
       assertTrue( m.getNumReactions() == 1 );
       r = null;
       r1 = null;
       m = null;
 }
Ejemplo n.º 2
0
 public void test_Model_createReaction()
 {
     Model m = new  Model(2,2);
       Reaction p = m.createReaction();
       assertTrue( m.getNumReactions() == 1 );
       assertTrue( (p).getLevel() == 2 );
       assertTrue( (p).getVersion() == 2 );
       m = null;
 }
Ejemplo n.º 3
0
 public void test_Model_addReaction3()
 {
     Model m = new  Model(2,2);
       Reaction r = new  Reaction(1,2);
       r.setId( "r");
       int i = m.addReaction(r);
       assertTrue( i == libsbml.LIBSBML_LEVEL_MISMATCH );
       assertTrue( m.getNumReactions() == 0 );
       r = null;
       m = null;
 }
Ejemplo n.º 4
0
 public void test_Model_addReaction4()
 {
     Model m = new  Model(2,2);
       Reaction r = null;
       int i = m.addReaction(r);
       assertTrue( i == libsbml.LIBSBML_OPERATION_FAILED );
       assertTrue( m.getNumReactions() == 0 );
       m = null;
 }
Ejemplo n.º 5
0
 public void test_ReadSBML_KineticLaw_Parameter()
 {
     Reaction r;
       KineticLaw kl;
       Parameter p;
       string s = wrapSBML_L1v2("<listOfReactions>" +
     "  <reaction name='J1'>" +
     "    <kineticLaw formula='k1*X0'>" +
     "      <listOfParameters>" +
     "        <parameter name='k1' value='0'/>" +
     "      </listOfParameters>" +
     "    </kineticLaw>" +
     "  </reaction>" +
     "</listOfReactions>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M.getNumReactions() == 1 );
       r = M.getReaction(0);
       kl = r.getKineticLaw();
       assertTrue((  "k1*X0" == kl.getFormula() ));
       assertTrue( kl.getNumParameters() == 1 );
       p = kl.getParameter(0);
       assertTrue((  "k1" == p.getId() ));
       assertTrue( p.getValue() == 0 );
 }
Ejemplo n.º 6
0
 public void test_Model_addReaction1()
 {
     Model m = new  Model(2,2);
       Reaction r = new  Reaction(2,2);
       int i = m.addReaction(r);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       r.setId( "r");
       i = m.addReaction(r);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumReactions() == 1 );
       r = null;
       m = null;
 }
Ejemplo n.º 7
0
 public void test_ReadSBML_KineticLaw()
 {
     Reaction r;
       KineticLaw kl;
       string s = wrapSBML_L1v2("<listOfReactions>" +
     "  <reaction name='J1'>" +
     "    <kineticLaw formula='k1*X0'/>" +
     "  </reaction>" +
     "</listOfReactions>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M.getNumReactions() == 1 );
       r = M.getReaction(0);
       kl = r.getKineticLaw();
       assertTrue((  "k1*X0" == kl.getFormula() ));
 }
Ejemplo n.º 8
0
 public void test_ReadSBML_KineticLaw_L2()
 {
     Reaction r;
       KineticLaw kl;
       ASTNode math;
       string formula;
       string s = wrapSBML_L2v1("<listOfReactions>" +
     "  <reaction id='J1'>" +
     "    <kineticLaw>" +
     "      <math>" +
     "        <apply>" +
     "          <times/>" +
     "          <ci> k  </ci>" +
     "          <ci> S2 </ci>" +
     "          <ci> X0 </ci>" +
     "        </apply>" +
     "      </math>" +
     "    </kineticLaw>" +
     "  </reaction>" +
     "</listOfReactions>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M.getNumReactions() == 1 );
       r = M.getReaction(0);
       assertTrue( r != null );
       kl = r.getKineticLaw();
       assertTrue( kl != null );
       assertEquals( true, kl.isSetMath() );
       math = kl.getMath();
       formula = kl.getFormula();
       assertTrue( formula != null );
       assertTrue((  "k * S2 * X0" == formula ));
 }
Ejemplo n.º 9
0
 public void test_ReadSBML_SpeciesReference_StoichiometryMath_2()
 {
     Reaction r;
       SpeciesReference sr;
       string s = wrapSBML_L2v1("<listOfReactions>" +
     "  <reaction name='r1'>" +
     "    <listOfReactants>" +
     "      <speciesReference species='X0'>" +
     "        <stoichiometryMath>" +
     "          <math> <cn type='rational'> 3 <sep/> 2 </cn> </math>" +
     "        </stoichiometryMath>" +
     "      </speciesReference>" +
     "    </listOfReactants>" +
     "  </reaction>" +
     "</listOfReactions>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M.getNumReactions() == 1 );
       r = M.getReaction(0);
       assertTrue( r != null );
       assertTrue( r.getNumReactants() == 1 );
       sr = r.getReactant(0);
       assertTrue( sr != null );
       assertEquals( false, sr.isSetStoichiometryMath() );
       assertTrue( sr.getStoichiometry() == 3 );
       assertTrue( sr.getDenominator() == 2 );
 }
Ejemplo n.º 10
0
 public void test_ReadSBML_SpeciesReference_StoichiometryMath_1()
 {
     Reaction r;
       SpeciesReference sr;
       StoichiometryMath math;
       string formula;
       string s = wrapSBML_L2v1("<listOfReactions>" +
     "  <reaction name='r1'>" +
     "    <listOfReactants>" +
     "      <speciesReference species='X0'>" +
     "        <stoichiometryMath>" +
     "          <math> <ci> x </ci> </math>" +
     "        </stoichiometryMath>" +
     "      </speciesReference>" +
     "    </listOfReactants>" +
     "  </reaction>" +
     "</listOfReactions>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M.getNumReactions() == 1 );
       r = M.getReaction(0);
       assertTrue( r != null );
       assertTrue( r.getNumReactants() == 1 );
       sr = r.getReactant(0);
       assertTrue( sr != null );
       assertEquals( true, sr.isSetStoichiometryMath() );
       math = sr.getStoichiometryMath();
       formula = libsbml.formulaToString(math.getMath());
       assertTrue( formula != null );
       assertTrue((  "x" == formula ));
 }
Ejemplo n.º 11
0
 public void test_ReadSBML_SpeciesReference_defaults()
 {
     Reaction r;
       SpeciesReference sr;
       string s = wrapSBML_L1v2("<listOfReactions>" +
     "  <reaction name='reaction_1' reversible='false'>" +
     "    <listOfReactants>" +
     "      <speciesReference species='X0'/>" +
     "    </listOfReactants>" +
     "  </reaction>" +
     "</listOfReactions>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M.getNumReactions() == 1 );
       r = M.getReaction(0);
       assertTrue((  "reaction_1" == r.getId() ));
       assertTrue( r.getReversible() == false );
       assertTrue( r.getNumReactants() == 1 );
       sr = r.getReactant(0);
       assertTrue((  "X0" == sr.getSpecies() ));
       assertTrue( sr.getStoichiometry() == 1 );
       assertTrue( sr.getDenominator() == 1 );
 }
Ejemplo n.º 12
0
 public void test_ReadSBML_Reaction_L2_defaults()
 {
     Reaction r;
       string s = wrapSBML_L2v1("<listOfReactions> <reaction id='r1'/> </listOfReactions>"
     );
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M.getNumReactions() == 1 );
       r = M.getReaction(0);
       assertEquals( true, r.isSetId() );
       assertEquals( false, r.isSetName() );
       assertEquals( false, r.isSetFast() );
       assertTrue((  "r1" == r.getId() ));
       assertTrue( r.getReversible() == true );
 }
Ejemplo n.º 13
0
 public void test_ReadSBML_Reaction_defaults()
 {
     Reaction r;
       string s = wrapSBML_L1v2("<listOfReactions>" +
     "  <reaction name='reaction_1'/>" +
     "</listOfReactions>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M.getNumReactions() == 1 );
       r = M.getReaction(0);
       assertTrue((  "reaction_1" == r.getId() ));
       assertTrue( r.getReversible() != false );
       assertTrue( r.getFast() == false );
 }