• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# libsbmlcs.SBMLDocument类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



SBMLDocument类属于libsbmlcs命名空间,在下文中一共展示了SBMLDocument类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: test_SBMLDocument_setLevelAndVersion

 public void test_SBMLDocument_setLevelAndVersion()
 {
     SBMLDocument d = new  SBMLDocument(2,2);
       Model m1 = new  Model(2,2);
       d.setModel(m1);
       assertTrue( d.setLevelAndVersion(2,3,false) == true );
       assertTrue( d.setLevelAndVersion(2,1,false) == true );
       assertTrue( d.setLevelAndVersion(1,2,false) == true );
       assertTrue( d.setLevelAndVersion(1,1,false) == false );
       d = null;
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:11,代码来源:TestSBMLDocument.cs


示例3: test_SBMLDocument_createWith

 public void test_SBMLDocument_createWith()
 {
     SBMLDocument d = new  SBMLDocument(1,2);
       assertTrue( d.getTypeCode() == libsbml.SBML_DOCUMENT );
       assertTrue( d.getNotes() == null );
       assertTrue( d.getAnnotation() == null );
       assertTrue( d.getLevel() == 1 );
       assertTrue( d.getVersion() == 2 );
       assertTrue( d.getNumErrors() == 0 );
       d = null;
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:11,代码来源:TestSBMLDocument.cs


示例4: test_CompartmentType_parent_NULL

 public void test_CompartmentType_parent_NULL()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       Model m = d.createModel();
       CompartmentType c = m.createCompartmentType();
       CompartmentType c1 = c.clone();
       d = null;
       assertTrue( c1.getAncestorOfType(libsbml.SBML_MODEL) == null );
       assertTrue( c1.getParentSBMLObject() == null );
       assertEquals(c1.getSBMLDocument(),null);
       c1 = null;
 }
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:12,代码来源:TestSBMLParentObject.cs


示例5: Main

    public static void Main(String[] args)
    {
        if (!SBMLExtensionRegistry.isPackageEnabled("comp"))
        {
          Console.WriteLine("This copy of libSBML does not contain the 'comp' extension");
          Console.WriteLine("Unable to proceed with the resolver example the model.");
          Environment.Exit(2);
        }

        // create custom resolver
        CustomResolver resolver = new CustomResolver();

        // add the resolver and store its index, so we can free it later.
        int index = SBMLResolverRegistry.getInstance().addResolver(resolver);

        // create a new document with comp enabled
        SBMLDocument doc = new SBMLDocument(new CompPkgNamespaces());

        // get a hold of a plugin object
        CompSBMLDocumentPlugin plugin = (CompSBMLDocumentPlugin)doc.getPlugin("comp");

        // create an external model definition
        ExternalModelDefinition external = plugin.createExternalModelDefinition();

        // set the source to the URI
        external.setSource("http://www.ebi.ac.uk/biomodels-main/download?mid=BMID000000063853");

        // resolve the model
        Model model = external.getReferencedModel();

        if (model == null)
        {
          Console.Error.WriteLine("couldn't resolve");
          Environment.Exit(2);
        }

        // model is ready to be used now, however, only as long and the document
        // holding the external model definition is still alive and referenced

        Console.WriteLine("Model id: " + model.getId());
        Console.WriteLine("# species: " + model.getNumSpecies());
        Console.WriteLine("# reactions: " + model.getNumReactions());

        // now that we are done get rid of the resolver
        SBMLResolverRegistry.getInstance().removeResolver(index);
        // also clear the resolver instance, just to be sure that it has
        // no more references to the C# resolver
        SBMLResolverRegistry.deleteResolerRegistryInstance();

        // finally we can get rid of the C# resolver
        resolver = null;
    }
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:52,代码来源:CustomResolver.cs


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


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


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


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


示例10: test_SBMLDocument_setLevelAndVersion_Error

 public void test_SBMLDocument_setLevelAndVersion_Error()
 {
     SBMLDocument d = new  SBMLDocument();
       d.setLevelAndVersion(2,1,true);
       Model m1 = new  Model(2,1);
       Unit u = new  Unit(2,1);
       u.setKind(libsbml.UnitKind_forName("mole"));
       u.setOffset(3.2);
       UnitDefinition ud = new  UnitDefinition(2,1);
       ud.setId( "ud");
       ud.addUnit(u);
       m1.addUnitDefinition(ud);
       d.setModel(m1);
       assertTrue( d.setLevelAndVersion(2,2,true) == false );
       assertTrue( d.setLevelAndVersion(2,3,true) == false );
       assertTrue( d.setLevelAndVersion(1,2,true) == false );
       assertTrue( d.setLevelAndVersion(1,1,true) == false );
       d = null;
 }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:19,代码来源:TestSBMLDocument.cs


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


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


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


示例14: writeExampleSBML

    /**
     *
     * Writes the given SBMLDocument to the given file.
     *
     */
    private static bool writeExampleSBML(SBMLDocument sbmlDoc, string filename)
    {
        int result = libsbml.writeSBML(sbmlDoc, filename);

        if (result == 1)
        {
            Console.WriteLine("Wrote file \"" + filename + "\"");
            return true;
        }
        else
        {
            Console.WriteLine("Failed to write \"" + filename + "\"");
            return false;
        }
    }
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:20,代码来源:createExampleSBML.cs


示例15: createExampleEnzymaticReaction

    //===============================================================================
    //
    //
    // Functions for creating the Example SBML documents.
    //
    //
    //===============================================================================
    /**
     *
     * Creates an SBML model represented in "7.1 A Simple example application of SBML"
     * in the SBML Level 2 Version 4 Specification.
     *
     */
    private static SBMLDocument createExampleEnzymaticReaction()
    {
        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("EnzymaticReaction");

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

        // Temporary pointers (reused more than once below).

        UnitDefinition unitdef;
        Unit unit;

        //---------------------------------------------------------------------------
        // (UnitDefinition1) Creates an UnitDefinition object ("per_second")
        //---------------------------------------------------------------------------

        unitdef = model.createUnitDefinition();
        unitdef.setId("per_second");

        //  Creates an Unit inside the UnitDefinition object

        unit = unitdef.createUnit();
        unit.setKind(libsbml.UNIT_KIND_SECOND);
        unit.setExponent(-1);

        //--------------------------------------------------------------------------------
        // (UnitDefinition2) Creates an UnitDefinition object ("litre_per_mole_per_second")
        //--------------------------------------------------------------------------------

        // Note that we can reuse the pointers 'unitdef' and 'unit' because the
        // actual UnitDefinition object (along with the Unit objects within it)
        // is already attached to the Model object.

        unitdef = model.createUnitDefinition();
        unitdef.setId("litre_per_mole_per_second");

        //  Creates an Unit inside the UnitDefinition object ("litre_per_mole_per_second")

        unit = unitdef.createUnit();
        unit.setKind(libsbml.UNIT_KIND_MOLE);
        unit.setExponent(-1);

        //  Creates an Unit inside the UnitDefinition object ("litre_per_mole_per_second")

        unit = unitdef.createUnit();
        unit.setKind(libsbml.UNIT_KIND_LITRE);
        unit.setExponent(1);

        //  Creates an Unit inside the UnitDefinition object ("litre_per_mole_per_second")

        unit = unitdef.createUnit();
        unit.setKind(libsbml.UNIT_KIND_SECOND);
        unit.setExponent(-1);

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

        Compartment comp;
        string compName = "cytosol";

        // Creates a Compartment object ("cytosol")

        comp = model.createCompartment();
//.........这里部分代码省略.........
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:101,代码来源:createExampleSBML.cs


示例16: validateExampleSBML

    //===============================================================================
    //
    //
    // Helper functions for writing/validating the given SBML documents.
    //
    //
    //===============================================================================
    /**
     *
     *  Validates the given SBMLDocument.
     *
     *   This function is based on validateSBML.cpp implemented by
     *   Sarah Keating, Ben Bornstein, and Michael Hucka.
     *
     */
    private static bool validateExampleSBML(SBMLDocument sbmlDoc)
    {
        if (sbmlDoc == null)
        {
            Console.Error.WriteLine("validateExampleSBML: given a null SBML Document");
            return false;
        }

        string consistencyMessages = "";
        string validationMessages = "";
        bool noProblems = true;
        int numCheckFailures = 0;
        int numConsistencyErrors = 0;
        int numConsistencyWarnings = 0;
        int numValidationErrors = 0;
        int numValidationWarnings = 0;

        // LibSBML 3.3 is lenient when generating models from scratch using the
        // API for creating objects.  Once the whole model is done and before it
        // gets written out, it's important to check that the whole model is in
        // fact complete, consistent and valid.

        numCheckFailures = (int)sbmlDoc.checkInternalConsistency();
        if (numCheckFailures > 0)
        {
            noProblems = false;
            for (int i = 0;
            i < numCheckFailures;
            i++)
            {
                SBMLError sbmlErr = sbmlDoc.getError(i);
                if (sbmlErr.isFatal() || sbmlErr.isError())
                {
                    ++numConsistencyErrors;
                }
                else
                {
                    ++numConsistencyWarnings;
                }
            }
            consistencyMessages = sbmlDoc.getErrorLog().toString();
        }

        // If the internal checks fail, it makes little sense to attempt
        // further validation, because the model may be too compromised to
        // be properly interpreted.

        if (numConsistencyErrors > 0)
        {
            consistencyMessages += "Further validation aborted.";
        }
        else
        {
            numCheckFailures = (int)sbmlDoc.checkConsistency();
            if (numCheckFailures > 0)
            {
                noProblems = false;
                for (int i = 0;
                i < numCheckFailures;
                i++)
                {
                    SBMLError sbmlErr = sbmlDoc.getError(i);
                    if (sbmlErr.isFatal() || sbmlErr.isError())
                    {
                        ++numValidationErrors;
                    }
                    else
                    {
                        ++numValidationWarnings;
                    }
                }

                validationMessages = sbmlDoc.getErrorLog().toString();
            }
        }

        if (noProblems)
            return true;
        else
        {
            if (numConsistencyErrors > 0)
            {
                Console.WriteLine("ERROR: encountered " + numConsistencyErrors
                + " consistency error" + (numConsistencyErrors == 1 ? "" : "s")
                + " in model '" + sbmlDoc.getModel().getId() + "'.");
//.........这里部分代码省略.........
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:101,代码来源:createExampleSBML.cs


示例17: test_SBMLDocument_constructor

        public void test_SBMLDocument_constructor()
        {
            SBase s;

              try
              {
            s = new SBMLDocument(1,1);
            s = new SBMLDocument(1,2);
            s = new SBMLDocument(2,1);
            s = new SBMLDocument(2,2);
            s = new SBMLDocument(2,3);
            s = new SBMLDocument(2,4);
            s = new SBMLDocument(3,1);
            s = new SBMLDocument(SN11);
            s = new SBMLDocument(SN12);
            s = new SBMLDocument(SN21);
            s = new SBMLDocument(SN22);
            s = new SBMLDocument(SN23);
            s = new SBMLDocument(SN24);
            s = new SBMLDocument(SN31);
              }
              catch (SBMLConstructorException e)
              {
             s = null;
              }
              assertTrue(s != null);

              string msg = "";

              try
              {
            s = new SBMLDocument(9,9);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);

              msg = "";

              try
              {
            s = new SBMLDocument(SN99);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);
        }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:51,代码来源:TestSBMLConstructorException.cs


示例18: testWriteSBML

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

             try
             {
                 string sbmlstr = libsbml.writeSBMLToString(d);

                 if ( libsbml.writeSBML(libsbml.readSBMLFromString(sbmlstr), file) == 0)
                 {
                     ERR("[WriteSBML] Error: cannot write " + file);
                 }
                 else
                 {
                     OK();
                 }
              }
              catch (Exception e)
              {
                  ERR("[WriteSBML] (" + file + ") Error: Exception thrown : " + e.Message);
              }
        }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:36,代码来源:TestRW.cs


示例19: testWriteCompressedSBML

        static void testWriteCompressedSBML(SBMLDocument d, string file)
        {
            if ( SBMLWriter.hasZlib() )
            {
                //
                // write/read gzip file
                //
                string cfile = file + ".gz";
                try
                {
                    if ( libsbml.writeSBML(d, cfile) == 0)
                    {
                        ERR("[WriteCompressedSBML] Error: cannot write " + file + ".gz");
                    }
                    else
                    {
                        OK();
                    }
                 }
                 catch (Exception e)
                 {
                    ERR("[WriteCompressedSBML] (" + cfile + ") Error: Exception thrown : " + e.Message);
                 }

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

              if ( SBMLWriter.hasBzip2() )
              {
                  //
                  // write/read bzip2 file
                  //
                  string cfile = file + ".bz2";
                  try
                  {
                      if (libsbml.writeSBML(d, cfile) == 0)
                      {
                          ERR("[WriteCompressedSBML] Error: cannot write " + cfile);
                      }
                      else
                      {
                          if ( libsbml.readSBML(cfile) == null)
                          {
                              ERR("[WriteCompressedSBML] Error: failed to read " + cfile);
                          }
                          else
                          {
                              OK();
                          }
                      }
                  }
                  catch (Exception e)
                  {
                      ERR("[WriteCompressedSBML] (" + cfile + ") Error: Exception thrown : " + e.Message);
                  }
              }
        }
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:75,代码来源:TestRW.cs


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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# libsbmlcs.SBMLNamespaces类代码示例发布时间:2022-05-26
下一篇:
C# libsbmlcs.Reaction类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap