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


C# SBMLDocument.getModel方法代码示例

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


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

示例1: setUp

 public void setUp()
 {
     string filename = "../../sbml/annotation/test/test-data/annotationL3.xml";
       d = libsbml.readSBML(filename);
       m = d.getModel();
       c = m.getCompartment(0);
 }
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:7,代码来源:TestL3ModelHistory.cs

示例2: test_SBMLConvertStrict_convertNonStrictSBO

 public void test_SBMLConvertStrict_convertNonStrictSBO()
 {
     SBMLDocument d = new  SBMLDocument(2,4);
       Model m = d.createModel();
       Compartment c = m.createCompartment();
       c.setId( "c");
       c.setConstant(false);
       (c).setSBOTerm(64);
       assertTrue( d.setLevelAndVersion(2,3,true) == false );
       assertTrue( d.getLevel() == 2 );
       assertTrue( d.getVersion() == 4 );
       assertTrue( d.setLevelAndVersion(2,2,true) == false );
       assertTrue( d.getLevel() == 2 );
       assertTrue( d.getVersion() == 4 );
       assertTrue( d.setLevelAndVersion(2,1,true) == true );
       assertTrue( d.getLevel() == 2 );
       assertTrue( d.getVersion() == 1 );
       Compartment c1 = d.getModel().getCompartment(0);
       assertTrue( (c1).getSBOTerm() == -1 );
       assertTrue( d.setLevelAndVersion(1,2,true) == true );
       assertTrue( d.getLevel() == 1 );
       assertTrue( d.getVersion() == 2 );
       Compartment c2 = d.getModel().getCompartment(0);
       assertTrue( (c2).getSBOTerm() == -1 );
       d = null;
 }
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:26,代码来源:TestSBMLConvertStrict.cs

示例3: test_SBMLConvertStrict_convertL1ParamRule

 public void test_SBMLConvertStrict_convertL1ParamRule()
 {
     SBMLDocument d = new  SBMLDocument(1,2);
       Model m = d.createModel();
       Compartment c = m.createCompartment();
       c.setId( "c");
       Parameter p = m.createParameter();
       p.setId( "p");
       Parameter p1 = m.createParameter();
       p1.setId( "p1");
       ASTNode math = libsbml.parseFormula("p");
       Rule ar = m.createAssignmentRule();
       ar.setVariable( "p1");
       ar.setMath(math);
       ar.setUnits( "mole");
       assertTrue( d.setLevelAndVersion(2,1,true) == true );
       assertTrue( d.getLevel() == 2 );
       assertTrue( d.getVersion() == 1 );
       Rule r1 = d.getModel().getRule(0);
       assertTrue( r1.getUnits() == "" );
       d = null;
 }
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:22,代码来源:TestSBMLConvertStrict.cs

示例4: test_ReadSBML_FunctionDefinition

 public void test_ReadSBML_FunctionDefinition()
 {
     FunctionDefinition fd;
       ASTNode math;
       string formula;
       string s = wrapSBML_L2v1("<listOfFunctionDefinitions>" +
     "  <functionDefinition id='pow3' name='cubed'>" +
     "    <math>" +
     "      <lambda>" +
     "        <bvar><ci> x </ci></bvar>" +
     "        <apply>" +
     "          <power/>" +
     "          <ci> x </ci>" +
     "          <cn> 3 </cn>" +
     "        </apply>" +
     "      </lambda>" +
     "    </math>" +
     "  </functionDefinition>" +
     "</listOfFunctionDefinitions>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M.getNumFunctionDefinitions() == 1 );
       fd = M.getFunctionDefinition(0);
       assertTrue( fd != null );
       assertEquals( true, fd.isSetId() );
       assertEquals( true, fd.isSetName() );
       assertTrue((  "pow3"   == fd.getId() ));
       assertTrue((  "cubed"  == fd.getName() ));
       assertEquals( true, fd.isSetMath() );
       math = fd.getMath();
       formula = libsbml.formulaToString(math);
       assertTrue( formula != null );
       assertTrue((  "lambda(x, pow(x, 3))" == formula ));
 }
开发者ID:yarden,项目名称:roadrunner,代码行数:34,代码来源:TestReadSBML.cs

示例5: test_SBMLConvertStrict_convertToL1

 public void test_SBMLConvertStrict_convertToL1()
 {
     SBMLDocument d = new  SBMLDocument(2,4);
       Model m = d.createModel();
       (m).setMetaId( "_m");
       Compartment c = m.createCompartment();
       c.setId( "c");
       (c).setSBOTerm(240);
       Species s = m.createSpecies();
       s.setId( "s");
       s.setCompartment( "c");
       assertTrue( d.setLevelAndVersion(1,2,true) == true );
       assertTrue( d.getLevel() == 1 );
       assertTrue( d.getVersion() == 2 );
       Model m1 = d.getModel();
       assertTrue( (m1).getMetaId() == "" );
       Compartment c1 = m1.getCompartment(0);
       assertTrue( (c1).getSBOTerm() == -1 );
       Species s1 = m1.getSpecies(0);
       assertTrue( s1.getHasOnlySubstanceUnits() == false );
       d = null;
 }
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:22,代码来源:TestSBMLConvertStrict.cs

示例6: test_SBMLConvert_convertToL3_localParameters

 public void test_SBMLConvert_convertToL3_localParameters()
 {
     SBMLDocument d = new  SBMLDocument(1,2);
       Model m = d.createModel();
       Compartment c = m.createCompartment();
       c.setId( "c" );
       Species s = m.createSpecies();
       s.setId( "s");
       s.setCompartment( "c");
       Reaction r = m.createReaction();
       SpeciesReference sr = r.createReactant();
       sr.setSpecies( "s");
       KineticLaw kl = r.createKineticLaw();
       kl.setFormula( "s*k");
       Parameter p = kl.createParameter();
       p.setId( "k");
       assertTrue( kl.getNumLocalParameters() == 0 );
       assertTrue( d.setLevelAndVersion(3,1,false) == true );
       m = d.getModel();
       r = m.getReaction(0);
       kl = r.getKineticLaw();
       assertTrue( kl.getNumLocalParameters() == 1 );
       LocalParameter lp = kl.getLocalParameter(0);
       d = null;
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:25,代码来源:TestSBMLConvert.cs

示例7: test_SBMLConvert_convertFromL3_modelUnits

 public void test_SBMLConvert_convertFromL3_modelUnits()
 {
     UnitDefinition ud;
       SBMLDocument d = new  SBMLDocument(3,1);
       Model m = d.createModel();
       m.setVolumeUnits( "litre");
       assertTrue( m.getNumUnitDefinitions() == 0 );
       assertTrue( d.setLevelAndVersion(1,2,false) == true );
       m = d.getModel();
       assertTrue( m.getNumUnitDefinitions() == 1 );
       ud = m.getUnitDefinition(0);
       assertTrue((  "volume" == ud.getId() ));
       assertTrue( ud.getNumUnits() == 1 );
       assertTrue( ud.getUnit(0).getKind() == libsbml.UNIT_KIND_LITRE );
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:15,代码来源:TestSBMLConvert.cs

示例8: test_Model_ancestor_create

 public void test_Model_ancestor_create()
 {
     SBMLDocument d = new SBMLDocument();
       Model m = d.createModel();
       assertTrue( m.getAncestorOfType(libsbml.SBML_DOCUMENT) == d );
       Model obj = d.getModel();
       assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == d );
       d = null;
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:9,代码来源:TestAncestor.cs

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

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

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

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

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

示例14: test_ReadSBML_FunctionDefinition_OnlyBVars

 public void test_ReadSBML_FunctionDefinition_OnlyBVars()
 {
     FunctionDefinition fd;
       SBMLError error;
       int numErrors;
       ASTNode math;
       string formula;
       string s = wrapSBML_L2v1("<listOfFunctionDefinitions>" +
     "  <functionDefinition id='invalid'>" +
     "    <math xmlns='http://www.w3.org/1998/Math/MathML'>" +
     "      <lambda>" +
     "        <bvar><ci> x </ci></bvar>" +
     "        <bvar><ci> y </ci></bvar>" +
     "        <bvar><ci> z </ci></bvar>" +
     "      </lambda>" +
     "    </math>" +
     "  </functionDefinition>" +
     "</listOfFunctionDefinitions>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       D.checkInternalConsistency();
       D.checkConsistency();
       numErrors = (int)D.getNumErrors();
       assertTrue( numErrors == 1 );
       error = D.getError(0);
       int errorId = (int)error.getErrorId();
       assertTrue( errorId == libsbml.NoBodyInFunctionDef );
       assertTrue( M.getNumFunctionDefinitions() == 1 );
       fd = M.getFunctionDefinition(0);
       assertTrue( fd != null );
       assertEquals( true, fd.isSetId() );
       assertEquals( false, fd.isSetName() );
       assertTrue((  "invalid"   == fd.getId() ));
       assertTrue( fd.getBody() == null );
       assertEquals( true, fd.isSetMath() );
       math = fd.getMath();
       formula = libsbml.formulaToString(math);
       assertTrue( formula != null );
       assertTrue((  "lambda(x, y, z)" == formula ));
 }
开发者ID:yarden,项目名称:roadrunner,代码行数:40,代码来源:TestReadSBML.cs

示例15: test_ReadSBML_FunctionDefinition_MathReturnsCN

 public void test_ReadSBML_FunctionDefinition_MathReturnsCN()
 {
     FunctionDefinition fd;
       ASTNode math;
       string formula;
       string s = wrapSBML_L2v1("<listOfFunctionDefinitions>" +
     "  <functionDefinition id='getNumber'>" +
     "    <math>" +
     "      <lambda>" +
     "        <bvar><ci> x </ci></bvar>" +
     "        <cn> 42 </cn>" +
     "      </lambda>" +
     "    </math>" +
     "  </functionDefinition>" +
     "</listOfFunctionDefinitions>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M.getNumFunctionDefinitions() == 1 );
       fd = M.getFunctionDefinition(0);
       assertTrue( fd != null );
       assertEquals( true, fd.isSetId() );
       assertEquals( false, fd.isSetName() );
       assertTrue((  "getNumber"   == fd.getId() ));
       assertEquals( true, fd.isSetMath() );
       math = fd.getMath();
       formula = libsbml.formulaToString(math);
       assertTrue( formula != null );
       assertTrue((  "lambda(x, 42)" == formula ));
 }
开发者ID:yarden,项目名称:roadrunner,代码行数:29,代码来源:TestReadSBML.cs


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