当前位置: 首页>>代码示例>>C#>>正文


C# Model.getNumReactions方法代码示例

本文整理汇总了C#中libsbmlcs.Model.getNumReactions方法的典型用法代码示例。如果您正苦于以下问题:C# Model.getNumReactions方法的具体用法?C# Model.getNumReactions怎么用?C# Model.getNumReactions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在libsbmlcs.Model的用法示例。


在下文中一共展示了Model.getNumReactions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: printMath

    private static void printMath(Model m)
    {
        int n;

        for (n = 0; n < m.getNumFunctionDefinitions(); ++n)
        {
            printFunctionDefinition(n + 1, m.getFunctionDefinition(n));
        }

        for (n = 0; n < m.getNumRules(); ++n)
        {
            printRuleMath(n + 1, m.getRule(n));
        }

        Console.WriteLine();

        for (n = 0; n < m.getNumReactions(); ++n)
        {
            printReactionMath(n + 1, m.getReaction(n));
        }

        Console.WriteLine();

        for (n = 0; n < m.getNumEvents(); ++n)
        {
            printEventMath(n + 1, m.getEvent(n));
        }
    }
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:28,代码来源:printMath.cs

示例2: test_Model_addReaction5

 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;
 }
开发者ID:,项目名称:,代码行数:17,代码来源:

示例3: test_Model_createReaction

 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;
 }
开发者ID:,项目名称:,代码行数:9,代码来源:

示例4: test_Model_addReaction3

 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;
 }
开发者ID:,项目名称:,代码行数:11,代码来源:

示例5: test_Model_addReaction4

 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;
 }
开发者ID:,项目名称:,代码行数:9,代码来源:

示例6: test_ReadSBML_KineticLaw_Parameter

 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 );
 }
开发者ID:yarden,项目名称:roadrunner,代码行数:25,代码来源:TestReadSBML.cs

示例7: test_Model_addReaction1

 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;
 }
开发者ID:,项目名称:,代码行数:13,代码来源:

示例8: test_ReadSBML_KineticLaw

 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() ));
 }
开发者ID:yarden,项目名称:roadrunner,代码行数:16,代码来源:TestReadSBML.cs

示例9: test_ReadSBML_KineticLaw_L2

 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 ));
 }
开发者ID:yarden,项目名称:roadrunner,代码行数:33,代码来源:TestReadSBML.cs

示例10: test_ReadSBML_SpeciesReference_StoichiometryMath_1

 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 ));
 }
开发者ID:yarden,项目名称:roadrunner,代码行数:31,代码来源:TestReadSBML.cs

示例11: test_ReadSBML_SpeciesReference_StoichiometryMath_2

 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 );
 }
开发者ID:yarden,项目名称:roadrunner,代码行数:27,代码来源:TestReadSBML.cs

示例12: test_ReadSBML_SpeciesReference_defaults

 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 );
 }
开发者ID:yarden,项目名称:roadrunner,代码行数:23,代码来源:TestReadSBML.cs

示例13: test_ReadSBML_Reaction_L2_defaults

 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 );
 }
开发者ID:yarden,项目名称:roadrunner,代码行数:15,代码来源:TestReadSBML.cs

示例14: test_ReadSBML_Reaction_defaults

 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 );
 }
开发者ID:yarden,项目名称:roadrunner,代码行数:14,代码来源:TestReadSBML.cs

示例15: InitializeFromFbcV2

        private void InitializeFromFbcV2(Model model, FbcModelPlugin plugin)
        {
            if (!plugin.getStrict())
              {
            Warnings.Add(
              "Encountered non-strict model, this software does not support any of the dynamic features of FBC V2, only the static features of the model are imported. ");
              }

              var numConstraints = plugin.getNumFluxBounds();
              for (int i = 0; i < numConstraints; i++)
              {
            var constraint = plugin.getFluxBound(i);
            Constraints.Add(new LPsolveConstraint(constraint.getReaction(), GetOperator(constraint.getOperation()),
              constraint.getValue()));
              }

              var activeObjective = plugin.getActiveObjective();
              if (activeObjective == null && plugin.getNumObjectives() > 0)
            activeObjective = plugin.getObjective(0);
              if (activeObjective == null) return;
              var numObjectives = (int)activeObjective.getNumFluxObjectives();
              for (int i = 0; i < numObjectives; i++)
              {
            var objective = activeObjective.getFluxObjective(i);
            Objectives.Add(new LPsolveObjective(objective.getReaction(), objective.getCoefficient()));
              }

              if (activeObjective.getType() == "minimize" || activeObjective.getType() == "minimise") Mode = FBA_Mode.minimize;
              else Mode = FBA_Mode.maximize;
              ActiveObjective = activeObjective.getId();

              for (int i = 0; i < model.getNumReactions(); i++)
              {
            var reaction = model.getReaction(i);
            ReversibilityMap[reaction.getId()] = reaction.getReversible();

            var rplug = (FbcReactionPlugin) reaction.getPlugin("fbc");
            if (rplug == null) continue;

            if (rplug.isSetLowerFluxBound())
            {
              var param = model.getParameter(rplug.getLowerFluxBound());
              if (param != null)
              {
            Constraints.Add(new LPsolveConstraint(reaction.getId(), lpsolve_constr_types.GE,
              param.getValue()));
              }
            }

            if (rplug.isSetUpperFluxBound())
            {
              var param = model.getParameter(rplug.getUpperFluxBound());
              if (param != null)
              {
            Constraints.Add(new LPsolveConstraint(reaction.getId(), lpsolve_constr_types.LE,
              param.getValue()));
              }
            }

            }
        }
开发者ID:fbergmann,项目名称:FluxBalance,代码行数:61,代码来源:FluxBalance.cs


注:本文中的libsbmlcs.Model.getNumReactions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。