Loading...
Searching...
No Matches
Additional complete example programs

The libSBML distribution comes with the following selection of complete example programs in the top-level file directory named `examples/python`.

# Simple programs

- createSimpleModel.py: Creates and prints a simple SBML Level 3 model.

- echoSBML.py: Echos (and in the process, pretty prints) an SBML model.

- readSBML.py: A simple command-line program that reads an SBML file and prints some statistics about it.

- printSBML.py: Prints information about the top-level model in the given SBML file.

- printRegisteredPackages.py: Prints the SBML Level 3 packages registered/installed in this copy of libSBML.

- printSupported.py: Prints the supported SBML Levels and Versions for this copy of libSBML.

# More advanced programs

- addCVTerms.py: Adds controlled vocabulary terms to a species in a model.

- addCustomValidator.py: Example of creating a custom validator to be called during validation.

- addModelHistory.py: Adds a model history to a model.

- addingEvidenceCodes_1.py: Adds controlled vocabulary terms to a reaction in a model.

- addingEvidenceCodes_2.py: Adds evidence codes to a species in a model.

- appendAnnotation.py: Adds annotation strings to a model and a species.

- callExternalValidator.py: Example that shows how to call an external program for validation.

- convertSBML.py: Example demonstrating how to convert SBML documents between SBML Levels.

- createExampleSBML.py: Lengthy example of creating SBML models presented in the SBML specification.

- getAllElementsWithNotes.py: Demonstrates how to use the element filter class to search the model for elements with specific attributes .

- printAnnotation.py: Prints the annotation strings for each element in a given model.

- printMath.py: Prints the rule, reaction, and event formulas in a given SBML document.

- printNotes.py: Prints the notes strings for each element in a given model.

- printRegisteredPackages.py: A command-line program that prints the package plug-ins that are registered with this copy of libSBML.

- printUnits.py: A command-line program that prints information about the units of measurement used in a given SBML file.

- promoteParameters.py: Promote all local parameters in the model to global parameters.

- setIdFromNames.py: Program that renames all SIds that also have names specified. The new identifiers will be derived from the name, with all invalid characters removed.

- setNamesFromId.py: Program that changes all objects' "name" attribute values to match their "id" attribute values.

- stripPackage.py: Strips the given SBML Level 3 package from the given SBML file.

- translateMath.py: Translates infix formulas into MathML and vice-versa.

- unsetAnnotation.py: Unsets the annotation for each element in the given SBML file.

- unsetNotes.py: Unsets the notes for each element in the given SBML file.

- validateSBML.py: Validates one or more SBML files.

# 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.py: Simple example of writing a model that uses the SBML Level 3 Flux Balance Constraints package.

- convertCobraToFbc.py: Example of converting a COBRA-style SBML Level 2 model to SBML Level 3 using the Flux Balance Constraints package.

- convertFbcToCobra.py: 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.py: 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.

- flattenModel.py: Model flattening example.

## 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.

- convertLayout.py: Converts SBML Layout and Render data from SBML Level 2 to Level 3 and vice versa.

- example1.py: An example layout.

- example1-L3.py: A version of `example1.py` for SBML Level 3.

## 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.py: An example of creating a model using SBML Level 3 Qualitative Models.