The libSBML distribution comes with the following selection of complete example programs in the top-level file directory named examples/csharp
.
Simple programs
- echoSBML.cs: Echos (and in the process, pretty prints) an SBML model.
- readSBML.cs: A simple command-line program that reads an SBML file and prints some statistics about it.
- printSBML.cs: Prints information about the top-level model in the given SBML file.
- printSupported.cs: Prints the supported SBML Levels and Versions for this copy of libSBML.
More advanced programs
- addCVTerms.cs: Adds controlled vocabulary terms to a species in a model.
- convertSBML.cs: Example demonstrating how to convert SBML documents between SBML Levels.
- getAllElementsWithNotes.cs: Demonstrates how to use the element filter class to search the model for elements with specific attributes .
- printMath.cs: Prints the rule, reaction, and event formulas in a given SBML document.
- printNotes.cs: Prints the notes strings for each element in a given model.
- printRegisteredPackages.cs: A command-line program that prints the package plug-ins that are registered with this copy of libSBML.
- printUnits.cs: A command-line program that prints information about the units of measurement used in a given SBML file.
- setIdFromNames.cs: Program that renames all SIds that also have names specified. The new identifiers will be derived from the name, with all invalid characters removed.
- stripPackage.cs: Strips the given SBML Level 3 package from the given SBML file.
- unsetNotes.cs: Unsets the notes for each element in the given SBML file.
Programs using SBML Level 3 packages
The following examples use specific libSBML plug-ins to support SBML Level 3 packages. The use of these packages requires your copy of libSBML to have been configured to enable the appropriate plug-in. The default installation of libSBML comes with the packages below already enabled, but beware that if you built libSBML from source code and disabled one or more of these packages, then their features will not be available.
Package: Flux Balance Constraints
The Flux Balance Constraints package has the nickname “fbc”. The libSBML classes that implement this package are marked with the symbol fbc
in the libSBML documentation.
- fbc_example1.cs: Simple example of writing a model that uses the SBML Level 3 Flux Balance Constraints package.
- convertCobraToFbc.cs: Example of converting a COBRA-style SBML Level 2 model to SBML Level 3 using the Flux Balance Constraints package.
- convertFbcToCobra.cs: Example of converting an SBML Level 3 model using the Flux Balance Constraints package to a COBRA-style SBML Level 2 model.
Package: Groups
The Groups package has the nickname “groups”. The libSBML classes that implement this package are marked with the symbol groups
in the libSBML documentation.
- groups_example1.cs: Simple example of writing a model that uses the SBML Level 3 Groups package.
Package: Hierarchical Model Composition
The Hierarchical Model Composition package has the nickname “comp”. The libSBML classes that implement this package are marked with the symbol comp
in the libSBML documentation.
- SpecExample1.cs: Example #1 from the SBML Level 3 Hierarchical Model Composition specification.
- SpecExample2.cs: Example #2 from the SBML Level 3 Hierarchical Model Composition specification.
- SpecExample3.cs: Example #3 from the SBML Level 3 Hierarchical Model Composition specification.
- SpecExample4.cs: Example #4 from the SBML Level 3 Hierarchical Model Composition specification.
Package: Layout
The Layout package has the nickname “layout”. The libSBML classes that implement this package are marked with the symbol layout
in the libSBML documentation.
Package: Qualitative Models
The Qualitative Models package has the nickname “qual”. The libSBML classes that implement this package are marked with the symbol qual
in the libSBML documentation.
- qual_example1.cs: An example of creating a model using SBML Level 3 Qualitative Models.