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


C# SBMLDocument.createModel方法代码示例

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


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

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

示例2: Main

    static void Main(string[] args)
    {
        SBMLNamespaces sbmlns = new SBMLNamespaces(3, 1, "distrib", 1);
        SBMLDocument document = new SBMLDocument(sbmlns);

        // set the required attribute to true
        DistribSBMLDocumentPlugin docPlug = (DistribSBMLDocumentPlugin)
                                            (document->getPlugin("distrib"));
        docPlug.setRequired(true);

        // create the Model

        Model model = document.createModel();

        // create the FunctionDefintion

        FunctionDefinition fd = model.createFunctionDefinition();
        fd.setId("mynormal");

        ASTNode math = libsbml.parseFormula("lambda(param1, param2, 0)");
        fd.setMath(math);

        //
        // Get a DistribFunctionDefinitionPlugin object plugged in the fd object.
        //
        // The type of the returned value of SBase::getPlugin() function is SBasePlugin, and
        // thus the value needs to be casted for the corresponding derived class.
        //
        DistribFunctionDefinitionPlugin fdPlugin =
                    (DistribFunctionDefinitionPlugin)(fd.getPlugin("distrib"));

        // create a DrawFromDistribution object
        DrawFromDistribution draw = fdPlugin.createDrawFromDistribution();

        // create the distribInputs
        DistribInput input1 = draw.createDistribInput();
        input1.setId("mu");
        input1.setIndex(0);

        DistribInput input2 = draw.createDistribInput();
        input2.setId("sigma");
        input2.setIndex(1);

        // create the UncertMLNode object
        UncertMLNode uncert = libsbml.createDistributionNode
                         ("NormalDistribution", "mean, variance", "mu,sigma");

        draw.setUncertML(uncert);

        libsbml.writeSBMLToFile(document, "distrib_example1.xml");
    }
开发者ID:kirichoi,项目名称:roadrunner,代码行数:51,代码来源:createNormalExample.cs

示例3: test_internal_consistency_check_20419

 public void test_internal_consistency_check_20419()
 {
     SBMLDocument d = new SBMLDocument(3,1);
       long errors;
       Model m = d.createModel();
       UnitDefinition ud = m.createUnitDefinition();
       errors = d.checkInternalConsistency();
       assertTrue( errors == 1 );
       assertTrue( d.getError(0).getErrorId() == 20419 );
       ud.setId("ud");
       d.getErrorLog().clearLog();
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:15,代码来源:TestInternalConsistencyChecks.cs

示例4: test_internal_consistency_check_20306

 public void test_internal_consistency_check_20306()
 {
     SBMLDocument d = new SBMLDocument(3,1);
       long errors;
       Model m = d.createModel();
       FunctionDefinition fd = m.createFunctionDefinition();
       fd.setId("fd");
       errors = d.checkInternalConsistency();
       assertTrue( errors == 1 );
       assertTrue( d.getError(0).getErrorId() == 20306 );
       ASTNode ast = libsbml.parseFormula("lambda(x, 2*x)");
       fd.setMath(ast);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:16,代码来源:TestInternalConsistencyChecks.cs

示例5: test_SBMLConvert_convertFromL3

 public void test_SBMLConvert_convertFromL3()
 {
     SBMLDocument d = new  SBMLDocument(3,1);
       Model m = d.createModel();
       string sid =  "C";
       Compartment c = m.createCompartment();
       c.setId(sid);
       c.setSize(1.2);
       c.setConstant(true);
       c.setSpatialDimensions(3.4);
       assertTrue( d.setLevelAndVersion(1,1,true) == false );
       assertTrue( d.setLevelAndVersion(1,2,true) == false );
       assertTrue( d.setLevelAndVersion(2,1,true) == false );
       assertTrue( d.setLevelAndVersion(2,2,true) == false );
       assertTrue( d.setLevelAndVersion(2,3,true) == false );
       assertTrue( d.setLevelAndVersion(2,4,true) == false );
       assertTrue( d.setLevelAndVersion(3,1,true) == true );
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:18,代码来源:TestSBMLConvert.cs

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

示例7: Main

    static void Main(string[] args)
    {
        SBMLNamespaces sbmlns = new SBMLNamespaces(3, 1, "distrib", 1);
        SBMLDocument document = new SBMLDocument(sbmlns);

        // set the required attribute to true
        DistribSBMLDocumentPlugin docPlug = (DistribSBMLDocumentPlugin)
                                            (document->getPlugin("distrib"));
        docPlug.setRequired(true);

        // create the Model

        Model model = document.createModel();

        // create the Parameter

        Parameter p = model.createParameter();
        p.setId("V");
        p.setConstant(true);

        //
        // Get a DistribSBasePlugin object plugged in the parameter object.
        //
        DistribSBasePlugin pPlugin =
                    (DistribSBasePlugin)(p.getPlugin("distrib"));

        // create a Uncertainty object
        Uncertainty uncert = pPlugin.createUncertainty();

        // create the UncertMLNode object
        UncertMLNode uncertML = libsbml.createDistributionNode
                         ("Statistics", "Mean, Variance", "V_pop, V_omega");

        uncert.setUncertML(uncertML);

        libsbml.writeSBMLToFile(document, "distrib_example2.xml");
    }
开发者ID:kirichoi,项目名称:roadrunner,代码行数:37,代码来源:createStatisticsExample+.cs

示例8: test_SBMLConvert_addModifiersToReaction

 public void test_SBMLConvert_addModifiersToReaction()
 {
     SBMLDocument d = new  SBMLDocument(1,2);
       Model m = d.createModel();
       Reaction r = m.createReaction();
       KineticLaw kl = r.createKineticLaw();
       kl.setFormula( "k1*S1*S2*S3*S4*S5");
       SimpleSpeciesReference ssr1;
       SimpleSpeciesReference ssr2;
       Species s1 = m.createSpecies();
       s1.setId( "S1" );
       Species s2 = m.createSpecies();
       s2.setId( "S2");
       Species s3 = m.createSpecies();
       s3.setId( "S3");
       Species s4 = m.createSpecies();
       s4.setId( "S4");
       Species s5 = m.createSpecies();
       s5.setId( "S5");
       SpeciesReference sr1 = r.createReactant();
       SpeciesReference sr2 = r.createReactant();
       SpeciesReference sr3 = r.createProduct();
       sr1.setSpecies( "S1");
       sr2.setSpecies( "S2");
       sr3.setSpecies( "S5");
       assertTrue( r.getNumModifiers() == 0 );
       assertTrue( d.setLevelAndVersion(2,1,false) == true );
       assertTrue( d.getLevel() == 2 );
       assertTrue( d.getVersion() == 1 );
       assertTrue( m.getReaction(0).getNumModifiers() == 2 );
       ssr1 = m.getReaction(0).getModifier(0);
       ssr2 = m.getReaction(0).getModifier(1);
       assertTrue((  "S3" == ssr1.getSpecies() ));
       assertTrue((  "S4" == ssr2.getSpecies() ));
       d = null;
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:36,代码来源:TestSBMLConvert.cs

示例9: test_SBMLConvert_convertToL1_Species_Amount

 public void test_SBMLConvert_convertToL1_Species_Amount()
 {
     SBMLDocument d = new  SBMLDocument(2,4);
       Model m = d.createModel();
       string sid =  "C";
       Compartment c = new  Compartment(2,4);
       Species s = new  Species(2,4);
       c.setId(sid);
       m.addCompartment(c);
       s.setCompartment(sid);
       s.setInitialAmount(2.34);
       m.addSpecies(s);
       assertTrue( d.setLevelAndVersion(1,2,true) == true );
       assertTrue( s.getInitialAmount() == 2.34 );
       d = null;
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:16,代码来源:TestSBMLConvert.cs

示例10: test_SBMLConvert_convertFromL3_conversionFactor

 public void test_SBMLConvert_convertFromL3_conversionFactor()
 {
     SBMLDocument d = new  SBMLDocument(3,1);
       Model m = d.createModel();
       string sid =  "P";
       m.setConversionFactor(sid);
       Parameter c = m.createParameter();
       c.setId(sid);
       c.setConstant(true);
       assertTrue( d.setLevelAndVersion(1,1,true) == false );
       assertTrue( d.setLevelAndVersion(1,2,true) == false );
       assertTrue( d.setLevelAndVersion(2,1,true) == false );
       assertTrue( d.setLevelAndVersion(2,2,true) == false );
       assertTrue( d.setLevelAndVersion(2,3,true) == false );
       assertTrue( d.setLevelAndVersion(2,4,true) == false );
       assertTrue( d.setLevelAndVersion(3,1,true) == true );
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:17,代码来源:TestSBMLConvert.cs

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

示例12: test_SBMLConvert_convertToL3_defaultUnits

 public void test_SBMLConvert_convertToL3_defaultUnits()
 {
     SBMLDocument d = new  SBMLDocument(1,2);
       Model m = d.createModel();
       string sid =  "C";
       Compartment c = m.createCompartment();
       c.setId(sid);
       c.setSize(1.2);
       c.setUnits( "volume");
       assertTrue( m.getNumUnitDefinitions() == 0 );
       assertTrue( d.setLevelAndVersion(3,1,true) == true );
       assertTrue( m.getNumUnitDefinitions() == 2 );
       UnitDefinition ud = m.getUnitDefinition(0);
       assertTrue( ud != null );
       assertTrue((  "volume" == ud.getId() ));
       assertTrue( ud.getNumUnits() == 1 );
       Unit u = ud.getUnit(0);
       assertTrue( u.getKind() == libsbml.UNIT_KIND_LITRE );
       assertTrue( u.getExponent() == 1 );
       assertTrue( u.getMultiplier() == 1 );
       assertTrue( u.getScale() == 0 );
       ud = m.getUnitDefinition(1);
       assertTrue( ud != null );
       assertTrue((  "time" == ud.getId() ));
       assertTrue( ud.getNumUnits() == 1 );
       u = ud.getUnit(0);
       assertTrue( u.getKind() == libsbml.UNIT_KIND_SECOND );
       assertTrue( u.getExponent() == 1 );
       assertTrue( u.getMultiplier() == 1 );
       assertTrue( u.getScale() == 0 );
       assertTrue((  "time" == m.getTimeUnits() ));
       d = null;
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:33,代码来源:TestSBMLConvert.cs

示例13: test_SBMLConvert_convertToL1_Species_Concentration

 public void test_SBMLConvert_convertToL1_Species_Concentration()
 {
     SBMLDocument d = new  SBMLDocument(2,1);
       Model m = d.createModel();
       string sid =  "C";
       Compartment c = new  Compartment(2,1);
       Species s = new  Species(2,1);
       c.setId(sid);
       c.setSize(1.2);
       m.addCompartment(c);
       s.setId( "s"  );
       s.setCompartment(sid);
       s.setInitialConcentration(2.34);
       m.addSpecies(s);
       assertTrue( d.setLevelAndVersion(1,2,true) == true );
       Species s1 = m.getSpecies(0);
       assertTrue( s1 != null );
       assertTrue((  "C" == s1.getCompartment() ));
       assertTrue( m.getCompartment( "C").getSize() == 1.2 );
       assertTrue( s1.getInitialConcentration() == 2.34 );
       assertTrue( s1.isSetInitialConcentration() == true );
       d = null;
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:23,代码来源:TestSBMLConvert.cs

示例14: testCreateSBML

        static void testCreateSBML()
        {
            SBMLDocument d = new SBMLDocument(defLevel,defVersion);

            Model m = d.createModel();
            m.setId("testmodel");

            Compartment c1 = m.createCompartment();
            Compartment c2 = m.createCompartment();
            c1.setId("c1");
            c2.setId("c2");

            Species s1 = m.createSpecies();
            Species s2 = m.createSpecies();

            string id1 = "s1";
            string id2 = "s2";

            // strings with non-ASCII characters (multibyte characters)
            string n1  = "γ-lyase";
            string n2  = "β-synthase";

            s1.setId(id1);
            s1.setName(n1);
            s1.setCompartment("c1");

            s2.setId(id2);
            s2.setName(n2);
            s2.setCompartment("c2");

            string file = "test2.xml";

            try
            {
                if ( libsbml.writeSBML(d, file) == 0)
                {
                    ERR("[CreateSBML] Error: cannot write " + file);
                }
                else
                {
                    OK();
                }
            }
            catch (Exception e)
            {
                ERR("[CreateSBML] (" + file + ") Error: Exception thrown : " + e.Message);
            }

            testReadSBMLFromFile(file);
        }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:50,代码来源:TestRW.cs

示例15: createExampleInvolvingFunctionDefinitions

    /**
     *
     * Creates an SBML model represented in "7.8 Example involving function definitions"
     * in the SBML Level 2 Version 4 Specification.
     *
     */
    private static SBMLDocument createExampleInvolvingFunctionDefinitions()
    {
        int level = Level;
        int version = Version;

        //---------------------------------------------------------------------------
        //
        // Creates an SBMLDocument object
        //
        //---------------------------------------------------------------------------

        SBMLDocument sbmlDoc = new SBMLDocument(level, version);

        //---------------------------------------------------------------------------
        //
        // Creates a Model object inside the SBMLDocument object.
        //
        //---------------------------------------------------------------------------

        Model model = sbmlDoc.createModel();
        model.setId("functionExample");

        //---------------------------------------------------------------------------
        //
        // Creates a FunctionDefinition object inside the Model object.
        //
        //---------------------------------------------------------------------------

        FunctionDefinition fdef = model.createFunctionDefinition();
        fdef.setId("f");

        // Sets a math (ASTNode object) to the FunctionDefinition object.

        string mathXMLString = "<math xmlns=\"http://www.w3.org/1998/Math/MathML\">"
        + "  <lambda>"
        + "    <bvar>"
        + "      <ci> x </ci>"
        + "    </bvar>"
        + "    <apply>"
        + "      <times/>"
        + "      <ci> x </ci>"
        + "      <cn> 2 </cn>"
        + "    </apply>"
        + "  </lambda>"
        + "</math>";

        ASTNode astMath = libsbml.readMathMLFromString(mathXMLString);
        fdef.setMath(astMath);

        //---------------------------------------------------------------------------
        //
        // Creates a Compartment object inside the Model object.
        //
        //---------------------------------------------------------------------------

        Compartment comp;
        const string compName = "compartmentOne";

        // Creates a Compartment object ("compartmentOne")

        comp = model.createCompartment();
        comp.setId(compName);

        // Sets the "size" attribute of the Compartment object.
        //
        //   The units of this Compartment object is the default SBML
        //   units of volume (litre), and thus we don't have to explicitly invoke
        //   setUnits("litre") function to set the default units.
        //
        comp.setSize(1);

        //---------------------------------------------------------------------------
        //
        // Creates Species objects inside the Model object.
        //
        //---------------------------------------------------------------------------

        Species sp;

        //---------------------------------------------------------------------------
        // (Species1) Creates a Species object ("S1")
        //---------------------------------------------------------------------------

        sp = model.createSpecies();
        sp.setId("S1");

        // Sets the "compartment" attribute of the Species object to identify the
        // compartnet in which the Species object located.

        sp.setCompartment(compName);

        // Sets the "initialConcentration" attribute of the Species object.
        //
        //  The units of this Species object is determined by two attributes of this
//.........这里部分代码省略.........
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:101,代码来源:createExampleSBML.cs


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