MathSBML

MathSBML Home Page MathSBML Site Map

SBMLRead Examples

Return Value  |   Options  |   Variable Names and Scoping  |   Examples

Click on an Example to jump directly to it.

  1. Read file and return a value using default settings.
  2. Read file and change context.
  3. Read file and only return some of the data.
  4. Read file without displaying its contents.
  5. Read file and display statistics.
  6. Read file and display an interpretive listing.
  7. Read, solve, and plot using SBMLNDSolve and SBMLPlot.
  8. Read, solve, and plot using native functions NDSolve and Plot.
  9. Read, solve, and plot using automated SBMLRead options.

Example 1: Read a file and return a value using default settings.

View input file.

Go to the top of this page

Example 2: Read a file and change the context; otherwise use all default settings.

View input file.

Go to the top of this page

Example 3: Read a file and inhibit the return of all data except for ODEs, species, and initial conditions.

View input file.

Go to the top of this page

Example 4: Read a file but do not display its contents.

If you put a semicolon at the end of the SBMLRead["enzyme.xml"] statement, the return value is not displayed. By setting it equal to m the value of m is set to the value returned by SBMLRead. The second input line, typing m without a semicolon, tells Mathematica to display the value of m.

View input file.

Go to the top of this page

Example 5: Read a file and display statistics.

View input file.

Go to the top of this page

Example 6: Verbose Listing.

View input file.


Click on the image to see it full size.

Go to the top of this page

Example 7: Read, Solve, and Plot.

View input file.

Here SBMLNDSolve is used to solve the model for 1 second, and then SBMLPlot is used to plot all model variables on a single graph. The /.{EK`Reaction2`k -> .1} is used to set the value of parameter k in reaction 2, since it is not defined in the model.

The following illsutrates what happens if we do not set the value of the missing parameter.

The line starting with >>Error is MathSBML catching the missing parameter and telling you that NSDSolve will probably crash. The next line, beginning with "NDSolve::ndnum" is the message generated by Mathematica. The final line, starting with "NDSolve[{EK ..." gives the actual call to NDSolve that failed.

Go to the top of this page

Example 8: Read, then solve and plot using native functions.

View input file.

Go to the top of this page

Example 9: Read, then solve and plot using automated options in SBMLRead.

View input file. - Note that this is a different imput file from the earlier versions because the parameter k in reaction 2 is set in the model!

Observe that there is an extra field - SBMLNumericalSolution - in the return value from SBMLRead.


Go to the top of this page