SBML Tutorial
SBML Tutorial
Sarah Keating
Science & Technology Research Institute University of Hertfordshire Hateld, Hertfordshire, UK
UH
1
Tutorial outline
1. Some background about SBML 2. SBML language basics 3. LibSBML and other SBML software infrastructure 4. Additional SBML features and SBML Level 2 Version 2 differences 5. A brief survey of SBML-compatible software 6. Closing comments and discussions
Computational models
General-purpose environments
General-purpose environments
Special-purpose software
model editing simulation analysis visualization
General-purpose environments
Special-purpose software
model editing simulation analysis visualization
CellDesigner
General-purpose environments
Special-purpose software
model editing simulation analysis visualization
CellDesigner
JDesigner
General-purpose environments
Special-purpose software
model editing simulation analysis visualization
COPASI
CellDesigner
JDesigner
Machine-readable format for representing computational models Suitable for reaction networks
Machine-readable format for representing computational models Suitable for reaction networks
Machine-readable format for representing computational models Suitable for reaction networks
Compartments (i.e., where chemical substances are located) Mathematical extras (assignments, explicit different eqs) Discontinuous events with arbitrary triggers
For transferring models between software tools Not meant as a systems internal format Not suited for representing
Accepted by journals
Nature PLoS Computational Biology BMC
SBML Levels
Levels are meant to coexist Level 1: mostly basic compartmental modeling Level 2: signicantly more featurese.g.:
User-dened functions Events Types for chemical species and compartments Initial conditions, constraints, other ddly bits
Embodies years of discussions and practical experience Most software currently only supports L2V1, not L2V2 yet
Meant to provide an exchange language for software tools Dont write SBML by hand if you can help it
<listOfReactants> <speciesReference species="MKKK"/> </listOfReactants> <listOfProducts> <speciesReference species="MKKK_P"/> </listOfProducts> <listOfModifiers> <modifierSpeciesReference species="MAPK_PP"/> </listOfModifiers> <kineticLaw> <math xmlns="http://www.w3.org/1998/Math/MathML"> <apply> <divide/> <apply> <times/> <ci> V1 </ci> <ci> MKKK </ci> </apply> <apply> <times/> <apply>
Meant to provide an exchange language for software tools Dont write SBML by hand if you can help it
Meant to provide an exchange language for software tools Dont write SBML by hand if you can help it
Software tools that speak SBML provide a higher-level interface Applications usually have their own native format
Import/export SBML rather than natively save as SBML
Basic elements
compartment_1
species D
compartment_2
Example #1
One reaction, 2A
Format: plain text (technically UTF-8) Extension: usually .xml (not .sbml)
order is signicant
listOf______s
SBase
Abstract type Most object structures in SBML are derived from SBase
<notes> allows human-readable annotations to be added
Format is XHTML
Identier
species id compartment id parameter id function id reaction id (L2v2)
Meaning
quantity of the species size of the compartment numerical value a call to that function rate of the reaction
Value of name is unrestricted (exception: no newlines or carriage returns) Must assign a value to id on most objects, but name is always optional
Some tools let you use names & auto-generate ids (e.g., COPASI)
References in MathML
References in MathML
References in MathML
References in MathML
Compartment basics
3, 2, 1, 0 (default: 3)
size
Floating-point number giving the compartment size (volume or other) Identier of the units of measure for the size Identier of the compartment outside of this one
Boolean: is the compartment size constant? (Default: true)
constant
Compartment example
... <listOfCompartments> <compartment id="cytoplasm" size="5"/> <compartment id="nucleus" size="1" outside="cytoplasm" /> </listOfCompartments> ... <listOfSpecies> <species id="X" compartment="nucleus" initialAmount="1" /> <species id="Y" compartment="cytoplasm" initialAmount="1" /> </listOfSpecies> ...
Species basics
Species basics
Identier of compartment where species is located Floating-point number giving initial quantity as molecular/item count Floating-point number giving initial quantity as concentration
initialAmount initialConcentration
Species basics
Identier of compartment where species is located Mutually exclusive initialAmount Floating-point number giving initial quantity as molecular/item count Floating-point number giving initial quantity as concentration
initialConcentration
Species basics
Identier of compartment where species is located Mutually exclusive initialAmount Floating-point number giving initial quantity as molecular/item count Floating-point number giving initial quantity as concentration
initialConcentration
boundaryCondition
Boolean: should a rate of change equation be constructed for the species based on the system of reactions? (Default: false) Boolean: is the species quantity constant? (Default: false)
constant
Think of species as a pool of molecules of the same type Species must be located in some compartment
If have the same species in multiple compartments, must have separate species denitions for each
Species example
<listOfSpecies> <species id="S1" initialConcentration="0" compartment="c1" boundaryCondition="true" /> <species id="S3" initialConcentration="10" compartment="c2" constant="true"/> <species id="S4" initialConcentration="4.5" compartment="c2"/> </listOfSpecies>
Parameter basics
units
Identier of the units of measure for the value
constant
Boolean: is the value of the parameter constant? (Default: true)
Parameter example
<listOfParameters> <parameter id="k1" value="0.5"/> <parameter id="k2" value="0.1"/> </listOfParameters>
Reaction basics
Reaction basics
id & name
Reaction basics
id & name
Reaction can have any number of reactants or products, but must have at least one reactant or product
Reaction can have any number of reactants or products, but must have at least one reactant or product A species can appear in both the list of reactants & list of products
E.g.: 2A
A+B
Reaction can have any number of reactants or products, but must have at least one reactant or product A species can appear in both the list of reactants & list of products
E.g.: 2A
A+B
A species labeled as modier may also appear in list of reactants and/or productsnot an either/or situation
Reaction can have any number of reactants or products, but must have at least one reactant or product A species can appear in both the list of reactants & list of products
E.g.: 2A
A+B
A species labeled as modier may also appear in list of reactants and/or productsnot an either/or situation A modier species appears in the rate expression but is neither created nor destroyed in that reaction
Reaction can have any number of reactants or products, but must have at least one reactant or product A species can appear in both the list of reactants & list of products
E.g.: 2A
A+B
A species labeled as modier may also appear in list of reactants and/or productsnot an either/or situation A modier species appears in the rate expression but is neither created nor destroyed in that reaction
no specic role assumed for modiers
ModierSpeciesReference does not add any more elds SpeciesReference adds elds for stoichiometry
ModierSpeciesReference does not add any more elds SpeciesReference adds elds for stoichiometry
ModierSpeciesReference does not add any more elds SpeciesReference adds elds for stoichiometry
Stoichiometries
Default value is 1
<reaction id="Dimerization" reversible="false"> <listOfReactants> <speciesReference species="P" stoichiometry="2"/> </listOfReactants> <listOfProducts> <speciesReference species="P2" /> </listOfProducts> ...
MathML expression Mutually exclusive with stoichiometry, use one or the other
Stoichiometries
Default value is 1
<reaction id="Dimerization" reversible="false"> <listOfReactants> <speciesReference species="P" stoichiometry="2"/> </listOfReactants> <listOfProducts> <speciesReference species="P2" /> </listOfProducts> ...
MathML expression Mutually exclusive with stoichiometry, use one or the other
Stoichiometries
Default value is 1
<reaction id="Dimerization" reversible="false"> <listOfReactants> <speciesReference species="P" stoichiometry="2"/> </listOfReactants> <listOfProducts> <speciesReference species="P2" /> </listOfProducts> ...
MathML expression Mutually exclusive with stoichiometry, use one or the other
KineticLaw basics
<math>
MathML expression for the speed of the reaction Units must be substance/time
<listOfParameters>
Denes parameters whose identiers have scope local to the reaction only
Not visible from any other reaction, or rest of model Identiers shadow global identiers
KineticLaw basics
<math>
MathML expression for the speed of the reaction Units must be substance/time not concentration/time
<listOfParameters>
Denes parameters whose identiers have scope local to the reaction only
Not visible from any other reaction, or rest of model Identiers shadow global identiers
Interpreting reactions
V1 S1 S2 V2
nS1 = [S1 ] V1
nS2 = [S2 ] V2
k [S1 ] V1 molecules leave the rst compartment 3 k [S1 ] V1 molecules enter the second compartment
Rate expressions are substance/time, not substance/size/time Conversion for basic cases is simple:
rate = k [S1 ] V1
Express rates of changes of reactants & products in terms of substances:
nS1 [S1 ] = V1
nS2 [S2 ] = V2
Rate expressions are substance/time, not substance/size/time Conversion for basic cases is simple:
rate = k [S1 ] V1
Express rates of changes of reactants & products in terms of substances:
nS1 [S1 ] = V1
nS2 [S2 ] = V2
Example #2
S1 S2 S3
Rate laws:
r1 = k1 [S1 ]
r2 = k2 [S2 ]
S1 V1 S1 = 4 V1 = 1
S2 V2
S3 V3 S2 = 10 S3 = 0
V2 = 0.5 V3 = 2 k2 = 0.7
k1 = 0.2
libSBML
Ben Bornstein and Sarah Keating
manipulate
Languages ISO C and C++ java python perl lisp MATLAB octave
(coming in libSBML-3)
Create a model
Model->create(my_model) Model->addCompartment(Compartment&)
MathML (Level 2)
<apply> <times/> <ci> k </ci> <ci> A </ci> <ci> B </ci> </apply>
Getting started
http://sourceforge.net/project/showfiles.php?group_id=7 1971&package_id=71670
Online validator
Ben Bornstein
http://sbml.org/validator/
SBMLToolbox
Sarah Keating
provides import/export between SBML and MATLAB provide examples of how MATLAB functionality can be applied to SBML models
Acknowledgements
Ben Kovitz Stefan Hoops Christoph Flamm Rainer Machne Martin Ginkel Mike Hucka Anyone who caught bugs, made suggestions, discussed
Break
Units in SBML
removed in L2V2
Redening units
Same mechanism for dening new units and redening the built-ins:
Unit identier namespace is global but different from space of other ids
mole
UnitDenition Unit
1 litre
Unit
1 second
Unit
w {ub } {u}
yb {ub } = y {u}
Units you want to convert into
w {ub } {u}
yb {ub } = y {u}
Units you want to convert into
w {ub } {u}
mole, kelvin, second, metre, litre, gram, kilogram, item, dimensionless, etc.
Denition of foot:
foot = (0.3048 "100 "metre)1 yb metres = 0.3048 "y feet
<listOfUnitDefinitions> <unitDefinition id="foot"> <listOfUnits> <unit kind="metre" multiplier="0.3048" exponent=1 scale=0/> </listOfUnits> </unitDefinition> </listOfUnitDefinitions>
E.g.: if need to express additional mathematical relationships beyond what is implied by the system of reactions
3 subtypes:
Rule type algebraic assignment rate General form Example 0 = S1 + S2 x=y+z dS/dt = 10.5
dS1 /dt = r1 + r2 + r3 + . . . dS2 /dt = r1 + r5 + . . . ... 0 = f1 (W) 0 = f2 (W) ... x = g1 (W) y = g2 (W) ... dm/dt = h1 (W) dq/dt = h2 (W) ...
Algebraic rules
Assignment rules
Rate rules
E.g.:
<assignmentRule variable="k"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <apply> <divide/> <ci> k3 </ci> <ci> k2 </ci> </apply> </math> </assignmentRule>
AssignmentRule
Assignment to a species, compartment or parameter overrides the initial value given in the denition Variable must not be set by both an AssignmentRule and a RateRule Variable must not be set by both an AssignmentRule and an InitialAssignment
RateRule
Can only happen if model contains algebraic rules Can be assessed statically (L2V2 spec contains one possible approach)
User-dened functions
All references to model variables must be passed as arguments References to other user-dened functions must be for functions dened earlier in the le
Events
Compartments
There is no default size! Extremely good practice to always set the size
Can use size eld, assignment rules, or (in L2V2) initial assignments
Species
Boolean: should species quantity always be as substance or substance/size? Important: setting initialAmount or initialConcentration does not imply units will be substance or substance/size, respectively
Species
Boolean: should species quantity always be as substance or substance/size? Important: setting initialAmount or initialConcentration does not imply units will be substance or substance/size, respectively
Boundary condition: when a species is a reactant or product in one or more reactions, but its quantity is not changed by those reactions
E.g., when a chemical is buffered in an experimental set-up, or the modeler wants to assume there is an innite quantity of the species ODE (or equivalent) shouldnt be constructed based on the reactions
Constant: if a species quantity is constant Different from being a boundary conditionboundaryCondition ag says whether an ODE should be constructed
Reactions
Reversibility:
Converse: if false, its a statement that the reaction only proceeds in the forward direction
Caution: not clear how to dene reversible reactions for stochastic simulation. Best practice: always dene 2 reactions explicitly in that case.
Multiple approaches:
1. Use the appropriate value eld on an element (most portable approach)
Element species compartment parameter Initial value eld(s) initialConcentration initialAmount size value
Initial assignments
Applies for t <= 0 Cannot have both an initial assignment and an assignment rule for the same identier
Constraints
Allows stating assumptions under which simulation is valid Intuitively: if the math expression is true, model is in a valid state
As soon as the expression evalues to false, the model is in an invalid state SBML does not require a particular action to be taken
But it would be a good idea for the software system to stop or at least indicate the model has failed a constraint
sboTerm
Independent, international, open effort of BioModels.net Consortium Occupies a space not lled by other ontologies
Primarily for describing rate laws and constituents 1. Classication of rate laws
2. Controlled vocabulary for the roles of reaction participants E.g.: substrate, catalyst, competitive inhibitor, etc.
3. Controlled vocabulary for the roles of quantitative parameters E.g.: Hill coefcient
SBO Browser
http://biomodels.net/SBO
Annotations
Applications can add data to each element in SBML Must have only one element enclosing an applications data
Content of <annotation> must be single top-level namespace Theres a recommended format for
1. referring to controlled vocabulary terms and database identiers for describing biological and biochemical entities 2. describing the creator of a model and its modication history
Uses RDF & a restricted set of Dublin Core to encode relationships Specic BioModels qualier names
http://biomodels.net
Break
Environment Mathematica
ODE x x x x x
Stoch
x x x x x x x x
x x x x
x x x x x
x x x x
x x x
x x x
MATLAB MATLAB
x x x
Special Features all of Mathematica sensitivity analysis, parameter scan., MCA, optimization parameter scan., sensitivity analysis parameter scan., sensitivity analysis compact language, MCA optimization, sensitivity analysis, all of MATLAB full-blown MATLAB product
x x x x
x x
x x part. x x x
x x x x x
MathSBML: http://sbml.org/software/mathsbml
Author: Bruce Shapiro (Caltech/JPL/BNMC) Most current documentation is online, not in download! Authors: P. Mendes, S.Hoops (Virginia Tech), S. Sahle, R.Gauges (EML Heidelberg) Authors: R. Machne, C. Flamm (U.Vienna) Author: Herbert Sauro (KGI) Author: Henning Schmidt (Chalmers, Sweden)
COPASI: http://copasi.org SBML ODE Solver: http://www.tbi.univie.ac.at/~raim/odeSolver/ Jarnac, JDesigner: http://sbw.kgi.edu SBToolbox: http://www.sbtoolbox.org/ CellDesigner: http://celldesigner.org SimBiology: http://mathworks.com Dizzy: http://www.systemsbiology.org/Technology/ Data_Visualization_and_Analysis/Dizzy
2A+BC CD+F Models can also include ... Compartments (i.e., where chemical substances are located)
Declarative, not procedural
Mathematical extras (assignments, explicit different eqs) Discontinuous events with arbitrary triggers
Successful as glue
Coalesced a community of software developers Allows interchange where none existed before
Successful as glue
Coalesced a community of software developers Allows interchange where none existed before
SBML Editors seek consensus and created integrated specication Polling & voting by community for major decisions
SBML Editors seek consensus and created integrated specication Polling & voting by community for major decisions
SBML Hackathon, June 2007, University of Newcastle (UK) SBML Forum Meeting 2007, Oct. 5-6, Long Beach, California (USA)
See http://icbs-2007.org
Keep informed!
Join [email protected] (low-volume, broadcast-only) Join sbml-discuss (higher volume, discussions & debates) Join libsbml-discuss (discussions & help about libsbml) See http://sbml.org/forums
NIH National Institute of General Medical Sciences (USA) National Science Foundation (USA) International Joint Research Program of NEDO (Japan) JST ERATO Kitano Symbiotic Systems Project (Japan) JST ERATO-SORST Program (Japan) Japanese Ministry of Agriculture Japanese Ministry of Education, Culture, Sports, Science and Tech. BBSRC e-Science Initiative (UK) DARPA IPTO Bio-Computation Program (USA) Air Force Ofce of Scientic Research (USA) STRI, University of Hertfordshire (UK) Beckman Institute, Caltech