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


C# Model.getReaction方法代码示例

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


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

示例1: test_ReadSBML_notes

 public void test_ReadSBML_notes()
 {
     Reaction r;
       KineticLaw kl;
       string s = wrapSBML_L2v3("<listOfReactions>" +
     "<reaction name='J1'>" +
     "  <kineticLaw formula='k1*X0'>" +
     "    <notes>This is a test note.</notes>" +
     "    <listOfParameters>" +
     "      <parameter name='k1' value='0'/>" +
     "    </listOfParameters>" +
     "  </kineticLaw>" +
     "</reaction>" +
     "</listOfReactions>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       r = M.getReaction(0);
       kl = r.getKineticLaw();
       assertTrue( kl.getNotes() != null );
       string notes = kl.getNotes().getChild(0).getCharacters();
       assertTrue( (  "This is a test note." != notes ) == false );
 }
开发者ID:yarden,项目名称:roadrunner,代码行数:22,代码来源:TestReadSBML.cs

示例2: test_Reaction_ancestor_add

 public void test_Reaction_ancestor_add()
 {
     Reaction ia = new Reaction(2,4);
       Model m = new Model(2,4);
       ia.setId("k");
       m.addReaction(ia);
       ia = null;
       ListOf lo = m.getListOfReactions();
       Reaction obj = m.getReaction(0);
       assertTrue( obj.getAncestorOfType(libsbml.SBML_MODEL) == m );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_EVENT) == null );
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:14,代码来源:TestAncestor.cs

示例3: test_ReadSBML_metaid

 public void test_ReadSBML_metaid()
 {
     SBase sb;
       string s = wrapSBML_L2v1("<listOfFunctionDefinitions>" +
     "  <functionDefinition metaid='fd'/>" +
     "</listOfFunctionDefinitions>" +
     "<listOfUnitDefinitions>" +
     "  <unitDefinition metaid='ud'/>" +
     "</listOfUnitDefinitions>" +
     "<listOfCompartments>" +
     "  <compartment metaid='c'/>" +
     "</listOfCompartments>" +
     "<listOfSpecies>" +
     "  <species metaid='s'/>" +
     "</listOfSpecies>" +
     "<listOfParameters>" +
     "  <parameter metaid='p'/>" +
     "</listOfParameters>" +
     "<listOfRules>" +
     "  <rateRule metaid='rr'/>" +
     "</listOfRules>" +
     "<listOfReactions>" +
     "  <reaction metaid='rx'/>" +
     "</listOfReactions>" +
     "<listOfEvents>" +
     " <event metaid='e'/>" +
     "</listOfEvents>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M != null );
       sb = M.getFunctionDefinition(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "fd" == sb.getMetaId() ));
       sb = M.getUnitDefinition(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "ud" == sb.getMetaId() ));
       sb = M.getCompartment(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "c" == sb.getMetaId() ));
       sb = M.getSpecies(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "s" == sb.getMetaId() ));
       sb = M.getParameter(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "p" == sb.getMetaId() ));
       sb = M.getRule(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "rr" == sb.getMetaId() ));
       sb = M.getReaction(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "rx" == sb.getMetaId() ));
       sb = M.getEvent(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "e" == sb.getMetaId() ));
 }
开发者ID:yarden,项目名称:roadrunner,代码行数:55,代码来源:TestReadSBML.cs

示例4: test_ReadSBML_metaid_Reaction

 public void test_ReadSBML_metaid_Reaction()
 {
     SBase sb;
       Reaction r;
       string s = wrapSBML_L2v1("<listOfReactions>" +
     "  <reaction metaid='r'>" +
     "    <listOfReactants metaid='lor'>" +
     "      <speciesReference metaid='sr1'/>" +
     "    </listOfReactants>" +
     "    <listOfProducts metaid='lop'>" +
     "      <speciesReference metaid='sr2'/>" +
     "    </listOfProducts>" +
     "    <listOfModifiers metaid='lom'>" +
     "      <modifierSpeciesReference metaid='msr'/>" +
     "    </listOfModifiers>" +
     "    <kineticLaw metaid='kl'/>" +
     "  </reaction>" +
     "</listOfReactions>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M != null );
       r = M.getReaction(0);
       sb = r;
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "r" == sb.getMetaId() ));
       sb = r.getListOfReactants();
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "lor" == sb.getMetaId() ));
       sb = r.getReactant(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "sr1" == sb.getMetaId() ));
       sb = r.getListOfProducts();
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "lop" == sb.getMetaId() ));
       sb = r.getProduct(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "sr2" == sb.getMetaId() ));
       sb = r.getListOfModifiers();
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "lom" == sb.getMetaId() ));
       sb = r.getModifier(0);
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "msr" == sb.getMetaId() ));
       sb = r.getKineticLaw();
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "kl" == sb.getMetaId() ));
 }
开发者ID:yarden,项目名称:roadrunner,代码行数:47,代码来源:TestReadSBML.cs

示例5: 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

示例6: test_ReadSBML_line_col_numbers

        public void test_ReadSBML_line_col_numbers()
        {
            //setXMLParser();

              SBase sb;
              string s = "<?xml version='1.0' encoding='UTF-8'?>\n" +
            "<sbml xmlns='http://www.sbml.org/sbml/level2' level='2' version='1'>\n" +
            "  <model id='testModel' name='testModel'>\n" +
            "    <listOfReactions> <reaction/> </listOfReactions>\n" +
            "  </model>\n" +
            "</sbml>\n";
              D = libsbml.readSBMLFromString(s);
              M = D.getModel();
              assertTrue( M != null );
              sb = M;
              sb = M.getListOfReactions();
              sb = M.getReaction(0);
        }
开发者ID:yarden,项目名称:roadrunner,代码行数:18,代码来源:TestReadSBML.cs

示例7: 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

示例8: test_Reaction_parent_create

 public void test_Reaction_parent_create()
 {
     Model m = new Model(2,4);
       Reaction r = m.createReaction();
       ListOf lo = m.getListOfReactions();
       assertTrue( lo == m.getReaction(0).getParentSBMLObject() );
       assertTrue( lo == r.getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:9,代码来源:TestSBMLParentObject.cs

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: test_Reaction_ancestor_create

 public void test_Reaction_ancestor_create()
 {
     Model m = new Model(2,4);
       Reaction r = m.createReaction();
       ListOf lo = m.getListOfReactions();
       assertTrue( r.getAncestorOfType(libsbml.SBML_MODEL) == m );
       assertTrue( r.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
       assertTrue( r.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       assertTrue( r.getAncestorOfType(libsbml.SBML_EVENT) == null );
       Reaction obj = m.getReaction(0);
       assertTrue( obj.getAncestorOfType(libsbml.SBML_MODEL) == m );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_EVENT) == null );
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:15,代码来源:TestAncestor.cs

示例15: 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


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