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


C# SBMLDocument.setPackageRequired方法代码示例

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


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

示例1: Main

    public static int Main(string[] args)
    {
        // Creates an SBMLNamespaces object with the given SBML level, version
        // package name, package version.
        SBMLNamespaces sbmlns = new SBMLNamespaces(3, 1, "qual", 1);

        // create the document
        SBMLDocument document = new SBMLDocument(sbmlns);

        // mark qual as required
        document.setPackageRequired("qual", true);

        // create the Model
        Model model = document.createModel();

        // create the Compartment
        Compartment compartment = model.createCompartment();
        compartment.setId("c");
        compartment.setConstant(true);

        // Get a QualModelPlugin object plugged in the model object.
        QualModelPlugin mplugin = (QualModelPlugin)(model.getPlugin("qual"));

        // create the QualitativeSpecies
        QualitativeSpecies qs = mplugin.createQualitativeSpecies();
        qs.setId("s1");
        qs.setCompartment("c");
        qs.setConstant(false);
        qs.setInitialLevel(1);
        qs.setMaxLevel(4);
        qs.setName("sss");

        // create the Transition
        Transition t = mplugin.createTransition();
        t.setId("d");
        t.setSBOTerm(1);

        Input i = t.createInput();
        i.setId("RD");
        i.setQualitativeSpecies("s1");
        i.setTransitionEffect(libsbml.INPUT_TRANSITION_EFFECT_NONE);
        i.setSign(libsbml.INPUT_SIGN_NEGATIVE);
        i.setThresholdLevel(2);
        i.setName("aa");

        Output o = t.createOutput();
        o.setId("wd");
        o.setQualitativeSpecies("s1");
        o.setTransitionEffect(libsbml.OUTPUT_TRANSITION_EFFECT_PRODUCTION);
        o.setOutputLevel(2);
        o.setName("aa");

        FunctionTerm ft = t.createFunctionTerm();
        ASTNode math = libsbml.parseL3Formula("geq(s1, 2)");
        ft.setResultLevel(1);
        ft.setMath(math);

        DefaultTerm dt = t.createDefaultTerm();
        dt.setResultLevel(2);

        int result = libsbml.writeSBML(document, "qual_example1.xml");

        if (result == 1)
        {
          Console.WriteLine("Wrote file");
          return 0;
        }
        else
        {
          Console.WriteLine("Failed to write");
          return 1;
        }
    }
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:73,代码来源:qual_example1.cs

示例2: Main

    public static void Main(string[] args)
    {
        ArraysPkgNamespaces arraysNs = new ArraysPkgNamespaces();
        SBMLDocument doc = new SBMLDocument(arraysNs);
        doc.setPackageRequired("arrays", true);
        Model model = doc.createModel();

        // create compartment
        Compartment comp = model.createCompartment();
        comp.setMetaId("dd");
        comp.setId("s");
        comp.setConstant(true);

        // set dimensions
        ArraysSBasePlugin compPlugin = (ArraysSBasePlugin) comp.getPlugin("arrays");
        Dimension dim = compPlugin.createDimension();
        dim.setId("i");
        dim.setSize("n");

        // create species
        Species species = model.createSpecies();
        species.setId("A");
        species.setCompartment("s");
        species.setHasOnlySubstanceUnits(false);
        species.setBoundaryCondition(false);
        species.setConstant(false);

        ArraysSBasePlugin splugin = (ArraysSBasePlugin) species.getPlugin("arrays");
        dim = splugin.createDimension();
        dim.setId("i");
        dim.setSize("n");

        species = model.createSpecies();
        species.setId("B");
        species.setCompartment("s");
        species.setHasOnlySubstanceUnits(false);
        species.setBoundaryCondition(false);
        species.setConstant(false);

        splugin = (ArraysSBasePlugin) species.getPlugin("arrays");
        dim = splugin.createDimension();
        dim.setId("i");
        dim.setSize("n");

        species = model.createSpecies();
        species.setId("C");
        species.setCompartment("s");
        species.setHasOnlySubstanceUnits(false);
        species.setBoundaryCondition(false);
        species.setConstant(false);

        splugin = (ArraysSBasePlugin) species.getPlugin("arrays");
        dim = splugin.createDimension();
        dim.setId("i");
        dim.setSize("n");

        // create parameter
        Parameter param = model.createParameter();
        param.setId("n");
        param.setValue(100);
        param.setConstant(true);

        // create reaction
        Reaction reaction = model.createReaction();
        reaction.setId("reaction1");
        reaction.setReversible(false);
        reaction.setFast(false);

        ArraysSBasePlugin reactionPlugin = (ArraysSBasePlugin) reaction.getPlugin("arrays");
        dim = reactionPlugin.createDimension();
        dim.setId("i");
        dim.setSize("n");

        SpeciesReference speciesRef = reaction.createReactant();
        speciesRef.setSpecies("A");
        speciesRef.setConstant(false);
        ArraysSBasePlugin refPlugin = (ArraysSBasePlugin) speciesRef.getPlugin("arrays");
        Index index = refPlugin.createIndex();
        ASTNode ast = new ASTNode(libsbml.AST_LINEAR_ALGEBRA_SELECTOR);
        ASTNode ci = new ASTNode(libsbml.AST_NAME);
        ci.setName("A");
        ast.addChild(ci);
        ci = new ASTNode(libsbml.AST_NAME);
        ci.setName("i");
        ast.addChild(ci);
        index.setMath(ast);

        speciesRef = reaction.createProduct();
        speciesRef.setSpecies("C");
        speciesRef.setConstant(false);
        refPlugin = (ArraysSBasePlugin) speciesRef.getPlugin("arrays");
        index = refPlugin.createIndex();
        ast = new ASTNode(libsbml.AST_LINEAR_ALGEBRA_SELECTOR);
        ci = new ASTNode(libsbml.AST_NAME);
        ci.setName("C");
        ast.addChild(ci);
        ci = new ASTNode(libsbml.AST_NAME);
        ci.setName("i");
        ast.addChild(ci);
        index.setMath(ast);
//.........这里部分代码省略.........
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:101,代码来源:CreateArrays1.cs

示例3: Main

    public static void Main(string[] args)
    {
        ArraysPkgNamespaces arraysNs = new ArraysPkgNamespaces();
        SBMLDocument doc = new SBMLDocument(arraysNs);
        doc.setPackageRequired("arrays", true);
        Model model = doc.createModel();

        // create parameters
        Parameter param = model.createParameter();
        param.setId("n");
        param.setValue(10);
        param.setConstant(true);

        param = model.createParameter();
        param.setId("m");
        param.setValue(10);
        param.setConstant(true);

        param = model.createParameter();
        param.setId("x");
        param.setValue(5.7);
        param.setConstant(true);

        ArraysSBasePlugin paramPlugin = (ArraysSBasePlugin) param.getPlugin("arrays");
        Dimension dim = paramPlugin.createDimension();
        dim.setId("i");
        dim.setSize("n");

        param = model.createParameter();
        param.setId("y");
        param.setConstant(false);

        paramPlugin = (ArraysSBasePlugin) param.getPlugin("arrays");
        dim = paramPlugin.createDimension();
        dim.setId("i");
        dim.setSize("n");

        param = model.createParameter();
        param.setId("z");
        param.setConstant(false);

        paramPlugin = (ArraysSBasePlugin) param.getPlugin("arrays");
        dim = paramPlugin.createDimension();
        dim.setId("i");
        dim.setSize("n");

        // create initial assignments

        InitialAssignment assignment = model.createInitialAssignment();
        assignment.setSymbol("y");
        ASTNode ast = new ASTNode(libsbml.AST_REAL);
        ast.setValue(3.2);
        assignment.setMath(ast);

        assignment = model.createInitialAssignment();
        assignment.setSymbol("z");
        ast = new ASTNode(libsbml.AST_REAL);
        ast.setValue(5.7);
        assignment.setMath(ast);

        ArraysSBasePlugin assignmentPlugin = (ArraysSBasePlugin) assignment.getPlugin("arrays");
        dim = assignmentPlugin.createDimension();
        dim.setId("i");
        dim.setSize("m");

        Index index = assignmentPlugin.createIndex();
        ASTNode newAst = new ASTNode(libsbml.AST_FUNCTION);
        newAst.setName("selector");
        ASTNode ci = new ASTNode(libsbml.AST_NAME);
        ci.setName("z");
        newAst.addChild(ci);
        ci = new ASTNode(libsbml.AST_NAME);
        ci.setName("i");
        newAst.addChild(ci);
        index.setMath(newAst);

        assignment = model.createInitialAssignment();
        assignment.setSymbol("z");
        ast = new ASTNode(libsbml.AST_REAL);
        ast.setValue(3.2);
        assignment.setMath(ast);

        assignmentPlugin = (ArraysSBasePlugin) assignment.getPlugin("arrays");
        dim = assignmentPlugin.createDimension();
        dim.setId("i");
        dim.setSize("m");

        index = assignmentPlugin.createIndex();
        newAst = new ASTNode(libsbml.AST_LINEAR_ALGEBRA_SELECTOR);
        ci = new ASTNode(libsbml.AST_NAME);
        ci.setName("z");
        newAst.addChild(ci);
        ASTNode plus = new ASTNode(libsbml.AST_PLUS);

        ci = new ASTNode(libsbml.AST_NAME);
        ci.setName("i");
        plus.addChild(ci);
        ci = new ASTNode(libsbml.AST_NAME);
        ci.setName("m");
        plus.addChild(ci);
//.........这里部分代码省略.........
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:101,代码来源:CreateArrays2.cs


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