User's Reference (SBTOOLBOX2)

Most up-to-date information
  • I try to keep the information in this user's reference up-to-date.
  • However, since I do have a job it is not always 100% possible.
  • You find the most up-to-date information when calling "help SBTOOLBOX2" in MATLAB.

Model Representation - Overview

Model SyntaxModels are described using an intuitive, user-friendly and powerful text based syntax, allowing the definition of ordinary differential equations, chemical reaction equations, etc. Additionally it is possible to define differential equations, initial conditions, variables, and reactions using a vectorized syntax. Learn more here!
Model RepresentationModels are represented in 2 different ways in the toolbox, leaving the user considerable freedom and ensuring easy reuse of already available MATLAB models. This section explains the internal storage format of SBmodels.

Experiment Representation - Overview

Experiment SyntaxInsilico experiments are described using an intuitive, user-friendly and quite powerful text based syntax. Learn more here!
Experiment RepresentationThe toolbox allows the representation of experiments and the merging with models. This section explains the internal storage format of SBexperiments.

Measurement Representation - Overview

Measurement SyntaxThe toolbox can handle measurement data, stored in comma-separated-value (CSV) and Excel (XLS) files. In both cases a certain syntax of the data in these files is required. Learn more here!
Measurement RepresentationThe toolbox allows handling and use of measurement data. This section explains the internal storage format of SBmeasurements.

Functions - Overview

Installation of Toolbox
 
installSBInstallation script for the toolbox.
helpSBSBTOOLBOX2 help function (requires internet connection).
 
Model Creation and Handling
 
SBmodelCreating a new SBmodel.
SBcreateTEXTmodelCreates new SBmodel TEXT file and opens it in editor.
SBcreateTEXTBCmodelCreates new SBmodel TEXTBC file and opens it in editor.
SBstructReturns the internal data structure of an SBmodel as a MATLAB structure.
SBeditGraphical user interface, allowing to edit and simulate SBmodels. Allows also to export SBmodels to ODE files, SBmodel files, SBML models.
SBeditBCGraphical user interface for editing SBmodels in a more biochemically oriented presentation.
isSBmodelChecks if the given argument is an SBmodel.
cleanmodelSBRemove unused reactions, variables and parameters from an SBmodel.
SBstatesReturns information about states in an SBmodel (statenames, a cell-array with names of states in model.
SBinitialconditionsSets or returns a models initial conditions.
SBalgebraicReturns information about algebraic rules in the model.
SBparametersReturns parameter names and values in an SBmodel or ODE file model. It is also possible to change parameter values.
SBvariablesReturns information about variables in an SBmodel (variable names and formulas, but also the variable values for given state).
SBreactionsReturns information about reactions in an SBmodel (reaction names and formulas of kinetic laws, but also the reaction rates for given state).
SBfunctionsReturns information about functions in an SBmodel (functions names, arguments, and formulas).
SBeventsReturns information about events in an SBmodel (names, triggers, assignment variables, and assignment formulas).
SBfunctionsMATLABReturns information about MATLAB functions in an SBmodel.
isparameterSBChecks if a given "name" is a parameter in given model.
isstateSBChecks if a given "name" is a state in given model.
isvariableSBChecks if a given "name" is a variable in given model.
isreactionSBChecks if a given "name" is a reaction in given model.
stateindexSBReturns the index of the given state in given model.
variableindexSBReturns the index of the given variable in given model.
reactionindexSBReturns the index of the given reaction in given model.
usedelaySBChecks if the given model uses delay functions.
useeventSBChecks if the given model uses events.
usealgebraicSBChecks if the given model contains algebraic rules.
usefastSBChecks if the given model contains fast reactions.
hasmoietyconservationsSBChecks if the given model contains moiety conservations.
 
Experiment Creation and Handling
 
SBexperimentCreating a new SBexperiment object.
SBstructReturns the internal data structure of an SBexperiment object as a MATLAB structure.
SBcreateEXPfileExports an SBexperiment object to a text file description.
SBmergemodexpMerges a model with an experiment description.
isSBexperimentChecks if the given argument is an SBexperiment.
 
Measurement Creation and Handling
 
SBmeasurementCreating a measurement data object SBmeasurement.
SBstructReturns the internal data structure of an SBmeasurement object as a MATLAB structure.
SBmeasurementdataAllows to extract information about the measurement data stored in an SBmeasurement object.
SBexportCSVmeasurementExporting an SBmeasurement object to a CSV (comma separated values) file.
SBexportXLSmeasurementExporting an SBmeasurement object to an Excel file.
SBexportXLSmeasurementsExporting several SBmeasurement objects to the same Excel file.
SBvisualizemeasurementVisualizing data in an SBmeasurement object graphically.
isSBmeasurementChecks if the given argument is an SBmeasurement object.
 
Export of SBmodel
 
SBcreateODEfileConverting an SBmodel to a MATLAB ODE file.
SBcreateTempODEfileSame as SBcreateODEfile but ODE file is created in the systems temporary directory.
deleteTempODEfileSBDeletes the ODE file created in the systems temporary directory.
SBcreateTEXTfileConverting an SBmodel to a ODE text file description.
SBcreateTEXTBCfileConverting an SBmodel to a biochemically oriented text file description.
SBexportSBMLExports an SBmodel to an SBML model.
SBconvert2MATakes an SBmodel and if possible returns the stoichiometric matrix, the numeric kinetic parameters, and the initial conditions.
 
Simulation Functions
 
SBsimulateSimulates an SBmodel or a ODE file model. Intergators, starting conditions, and other options can be chosen.
SBstochsimStochastic simulation of SBmodels.
 
Plotting Functions
 
SBplot(GUI) Plots time-series data.
SBplot2(GUI) Plots different kind of data where a block diagram representation is useful. So far mainly used for displaying results from parameter sensitivity analysis.
createdatastructSBplotSBGenerates a datastructure based on user defined inputes that can be plotted using SBplot.
createdatastruct2SBplotSBGenerates a datastructure based on simulation results returned from SBsimulate or SBPDsimulate to be plotted by SBplot.
 
Simple Analysis Functions
 
SBsteadystateDetermines the steady-state of an SBmodel or ODE file model, dealing also with singular systems
SBjacobianDetermines the Jacobian of a system at a given state by numerical differentiation.
SBmoietyconservationsDetermines the moitey and/or other conservations that are present in a model.
SBreducemodelAllows to reduce a singular model to a non-singular by deleting algebraic realtions from the ODEs, and replacing them by variables.
SBstoichiometryDetermines the stoichiometric matrix for the given model.
SBreactantstoichiometryDetermines the stoichiometric coefficients for the reactants only.
SBmakeirreversibleConverts the reversible reactions of an SBmodel into irreversible ones.
 
Local Parameter Sensitivity Analysis Functions
 
SBsensdataoscGenerating data for the parameter sensitivity analysis of oscillating systems.
SBsensdataosceventsGenerating data for the parameter sensitivity analysis of oscillating systems when events are present in the model.
SBsensamplitudeParameter sensitivity analysis of the oscillation amplitude. Uses data generated by SBsensdataosc.
SBsensperiodParameter sensitivity analysis of the oscillation period. Uses data generated by SBsensdataosc.
SBsensdatastatGenerating data for the parameter sensitivity analysis of the steady-state of systems.
SBsensstatParameter sensitivity analysis of the steady-state values of states, variables, and reaction rates (can be seen as a generalized MCA).
SBmcaMetabolic control analysis (MCA).
 
Global Parameter Sensitivity Analysis Functions
 
SBsensglobalfastExtended FAST.
SBsensglobalprccPRCC (Partial Rank Correlation Coefficient).
SBsensglobalsobolSobols method.
SBsensglobalwalsWALS (weighted average of local sensitivities).
 
Localization of Mechanisms leading to Complex Behaviors
 
SBlocbehavcompDetermines the importance of components in the given biochemical system in the creation of an observed complex behavior.
SBlocbehavinteractDetermines the importance of interactions between components in the given biochemical system in the creation of an observed complex behavior.
SBlocbehavinteract2Same as SBlocbehavinteract but no checking of stability is done.
 
Model Reduction Functions (Require the Symbolic Toolbox)
 
SBredallreacWrapper function that allows the reduction of all reaction rate expressions in a given model.
SBprepredreacThis function needs to be called prior to calling the SBredreac function in order to prepare the model and generate reference data.
SBredreacFunction that allows the reduction of the kinetic expression of a single rate expression.
 
Optimization
 
simplexSBLocal optimization algorithm (Nelder-Mead) (constrained).
simannealingSBGlobal optimization algorithm (constrained).
isresSBGlobal optimization algorithm (constrained).
SSmSBGlobal optimization algorithm for MINLP's based on Scatter Search (constrained).
fSSmSBGlobal optimization algorithm for MINLP's based on Scatter Search ("fast" Version) (constrained).
pswarmSBParticle swarm pattern search algorithm for global optimization (constrained).
 
Solvers
 
fsolveSBSolver for nonlinear equations based on Newton iterations.
 
Statistics
 
princompSBCompute principal components of a data matrix.
clusteringSBPerforms UPGMA on distance matrix and produces a dendrogram plot.
pdistSBDetermines the distance matrix for a set of points whose coordinates are given as row-vectors in the data matrix.
prctileSBDetermines the percentiles of a sample, based on interpolation.
boxplotSBPlots a box-and-whisker diagram for the given data.
chi2cdfSBCumulative density function of the chi-square distribution
chi2invSBQuantile function of the chi-square distribution
chi2pdfSBProbability density function of the chi-square distribution
tcdfSBCumulative density function of the t distribution
tinvSBQuantile function of the t distribution
tpdfSBProbability density function of the t distribution
gamcdfSBCumulative density function of the gamma distribution
gaminvSBQuantile function of the gamma distribution
gampdfSBProbability density function of the gamma distribution
normcdfSBCumulative densitiy function of the normal distribution
norminvSBQuantile function of the normal distribution
normpdfSBProbability density function of the normal distribution
swtestSBShapiro-Wilk parametric hypothesis test of composite normality
 
Signal
 
xcorrSBCompute correlation R_xy of X and Y for various lags k.
resampleSBresamples time series x1, which is sampled at the time instances t1 to time series x2 using a sampling defined by t2.
postpadSBExtends a vector or matrix in the given dimension with given values to a given length by appending the values.
prepadSBExtends a vector or matrix in the given dimension with given values to a given length by adding the values at the beginning.
centeredfftSBUses the fft function of MATLAB to determine a two sided spectrum of a data vector.
positivefftSBUses the fft function of MATLAB to determine a one sided spectrum of a data vector.
 
String handling functions (auxiliary functions)
 
explodePCSBAllows to decompose a string expression into separated elements. The separation character can be specified. Commas within parentheses expressions are not considered.
extractPSBThis function looks for the top level parentheses in the given text string and returns the substring that is located between these parentheses.
 
Special functions that can be used in models (auxiliary functions)
 
andSBLogical and.
orSBLogical or.
piecewiseSBImplementation of the SBML/MathML piecewise operator.
interp0SBLookup table for zero-order interpolation.
interp1SBLookup table for linear interpolation.
interpcsSBLookup table for cubic spline interpolation.
delaySBFunction that realizes delays.
 

Model/Experiment/Measurement Syntax - Full Description

The syntax of models, experiments, and measurements, as it is used by the SBTOOLBOX2, is best described by well documented examples. For this purpose there are plenty of examples included in the toolbox. Below you will find to almost each function description an executable example. Additionally there is an introductory tutorial available that can be found here:

Model Representation - Full Description

The toolbox's model representation uses two different levels of describing a model. On the high-level, an SBmodel is realized as a MATLAB object with a certain internal data structure, described in the table below. This allows the user and the analysis tools a large freedom in manipluating the model prior to, and during, analysis. All functions, as far as meaningful, should be able to work with a model given as an SBmodel.

Order of Computation

An SBmodel has states and corresponding ODEs, parameters, variables, reactions, functions, events, and MATLAB functions. Furthermore, it allows to specify algebraic rules and fast reactions. The dependencies between these elements are the following: The internal data structure of an SBmodel has the following fields:
nameName of the model (string)
notesNotes about the model (string)
functions.nameName of a function in the model (string)
functions.argumentsComma separated list of argument for the function (string)
functions.formulaFormula representing the function (string)
functions.notesNotes about the function (string)
states.nameName of a state in the model (string)
states.initialConditionInitial value of a state (numerical)
states.ODEODE expression determining the time derivative for the state (string)
states.typeAdditional information about the type of the state, needed for the export to SBML and eventually for the biochemical oriented representation. (string)
states.compartmentAdditional information for SBML export, etc. Not used if the state does not represent a species or a compartment. (string)
states.unittypeAdditional information for SBML export, etc. In case the state represents a species the unittype can be "concentration" or "amount". (string)
states.notesNotes about the state (string)
algebraic.nameName of a defined by an algebraic rule in the model (string)
algebraic.initialConditionInitial value of this state (numerical)
algebraic.formulamathematical expression defining the algebraic rule (string)
algebraic.typeAdditional information about the type of the algebraic state, needed for the export to SBML. (string)
algebraic.compartmentAdditional information for SBML export, etc. Not used if the algebraic state does not represent a species or a compartment. (string)
algebraic.unittypeAdditional information for SBML export, etc. In case the algebraic state represents a species the unittype can be "concentration" or "amount". (string)
algebraic.notesNotes about the algebraic state (string)
parameters.nameName of a parameter (string)
parameters.valueValue of a parameter (numerical)
parameters.typeAdditional information about the type of the parameter, needed for the export to SBML and eventually for the biochemical oriented representation. (string)
parameters.compartmentAdditional information for SBML export, etc. Not used if the state does not represent a species or a compartment. (string)
parameters.unittypeAdditional information for SBML export, etc. In case the state represents a species the unittype can be "concentration" or "amount". (string)
parameters.notesNotes about a parameter
variables.nameName of a variable (string)
variables.formulaFormula defining a variable (string)
variables.typeAdditional information about the type of the variable, needed for the export to SBML and eventually for the biochemical oriented representation. (string)
variables.compartmentAdditional information for SBML export, etc. Not used if the state does not represent a species or a compartment. (string)
variables.unittypeAdditional information for SBML export, etc. In case the state represents a species the unittype can be "concentration" or "amount". (string)
variables.notesNotes about a variable (string)
reactions.nameName of a reaction (string)
reactions.formulaFormula defining the rate law of a reaction (string)
reactions.notesNotes about a reaction (string)
reactions.reversibleFlag to indicate (ir)reversibility of a reaction (0=irreversible, 1=reversible)
reactions.fastFlag to indicate if this reaction is fast or not (0=not fast (default), 1=fast)
events.nameName of an event (string)
events.triggerTrigger expression for an event (string)
events.notesNotes about an event (string)
events.assignment.variableName of state variable that is affected (string)
events.assignment.formulaAssignment formula for affected state (string)
functionsMATLABString containing the definition of functions in MATLAB syntax (string)

The second model representation is that of an ODE function. An SBmodel can be converted to an ODE function by using the function SBcreateODEfile. If possible and reasonable, functions should also be able to work with a model given as an ODE function, however, this will not always be possible. The ODE function description used by this toolbox is compatible with the standard MATLAB ODE function description. However, this is not true in the other direction. Users wanting to use the toolbox with MATLAB models they already have developed as standard MATLAB ODE functions need to do change their models slightly, as described below.

In the case of events being present in the model the SBcreateODEfile can be used to also generate extra files that are needed to handle these events when simulating the model. If this is needed the functions of the toolbox will do this automatically. If these additional files are not needed for some analysis and events are present in the model a warning message will appear that the events are neglected.

Reuse of already available MATLAB models

The standard MATLAB ODE function description has the following syntax: [xdot] = matlabODEfunction(time,x). Here time is the time instant at which the function is evaluated, x is the state vector at time time and xdot is a column vector with the time derivatives of the states, which are calculated by the MATLAB ODE function.

The differences between the standard MATLAB ODE function and the ODE function, used in this toolbox, are the following alternative ways of calling the ODE function:

[initialConditions] = ODEfunction();

Calling the ODE function without arguments returns a vector containing initial conditions for the states. IMPORTANT: If the model contains algebraic rules, the initial conditions of the algebraic states are added to the result vector. If you only want to get the initial conditions of the ODEs you need to remove the number of elements from the end of this vector that corresponds to the number of algebraic rules in the model.

[stateNames] = ODEfunction('states');

Calling the ODE function in this way returns a MATLAB cell-array with the names of the states involved in the model. An example for a cell-array is: exampleCellArray = {'state1','state2','state3'}.

[algebraicNames] = ODEfunction('algebraic');

Returns the names of the algebraic states in a cell-array.

[parameterNames] = ODEfunction('parameters');

This returns a MATLAB cell-array with the names of the parameters, contained in the model.

[parameterValues] = ODEfunction('parametervalues');

This returns a column vector with the parameter values used in the model.

[xdot] = ODEfunction(time,x);

Returning the time derivative of the states at time time and state x. IMPORTANT: In the case that algebraic rules are present in the model the last n (where n is the number of algebraic rules in the model) elements in the return vector correspond to the evaluated algebraic rules.

In the following the terms ODE function and ODE file (and maybe some other terms) are describing the same thing.

Experiment Representation - Full Description

The idea behind the experiment description functionality is to be able to separate models from experiments. Previously the mathematics of in silico experiments had to be added to the models equations, eventually resulting in many different model instances to keep track off.

Using the experiment description only a nominal model (SBmodel) needs to be present. It can then be merged with different experiment descriptions, resulting in an updated SBmodel that can then be used to simulated the in silico experiment.

The separation of in silico experiment descriptions and in silico models matches very nicely to the wet lab experiments, in which the nominal system (e.g., a wild type yeast cell) is an entity and clearly separated physically from the experiments that are performed with it.

Experiments are represented in this toolbox by an SBexperiment object, that can be created using the SBexperiment function. The format for the experiment description is text based and in the structure similar to the SBmodel textual description.

Features of the experiment description:

The internal data structure of an SBexperiment object has the following fields:
nameName of the experiment (string)
notesNotes about the experiment (string)
paramicsettings.nameName of the state (parameter) for which the initial condition (value) is changed (string)
paramicsettings.formulaFormula for the determination of the initial condition or parameter value (string)
paramicsettings.notesNotes about this setting (string)
paramicsettings.icflag=0: Parameter setting, =1: Initial condition setting (string)
parameterchanges.nameName of the parameter for which the value is to be determined by an algebraic expression (string)
parameterchanges.formulaFormula for the determination of the parameter value (evaluated during the merged models execution) (string)
parameterchanges.notesNotes about this parameter (string)
stateevents.nameName of the state event (string)
stateevents.triggerTrigger for the state event (string)
stateevents.assignmentStructure defining the assignments (same structure as in the SBmodel description)
stateevents.notesNotes about the event (string)

Textual experiment descriptions can be imported to MATLAB using the SBexperiment function. Export of an SBexp object to the textual description is possible using the SBcreateEXPfile function. For an example please have a look in the SBTOOLBOX2/_EXAMPLES/experiment folder.

Measurement Representation - Full Description

Measurement data are represented in this toolbox by an SBmeasurement object, that can be created using the SBmeasurement function. Measurement data can be in-silico generated data and data obtained through real measurements.

The internal data structure of an SBmeasurement object has the following fields:
nameName of the measurement data (string)
notesNotes about the measurement data (string)
timeTime vector of sampling instants
data.nameName of the measured component (string)
data.notesNotes about the measured component (string)
data.valuesMeasured values (column vector of the same length as time). If no measurement has been made for the corresponding time instant the value should be set to NaN.
data.maxvaluesUpper errorbound of measured values (column vector of the same length as time). If no measurement has been made for the corresponding time instant the value should be set to NaN. If no error bound is available this field contains a vector with only NaN entries.
data.minvaluesLower errorbound of measured values (column vector of the same length as time). If no measurement has been made for the corresponding time instant the value should be set to NaN. If no error bound is available this field contains a vector with only NaN entries.

The data structure can contain measurements from different components. The time vector is global and contains all time instants at which measurements have been collected. In case that a certain component is not measured at a certain time instant, its value is to be set to NaN (not a number) to indicate this. In this way the number of measurements can be different for different components.

Measurement data can be imported from Excel and CSV (comma separated value) files, using the function SBmeasurement. Export to the same kind of files is possible using the functions SBexportXLSmeasurement, SBexportXLSmeasurements, and SBexportCSVmeasurement. For information on the required format of the Excel and CSV files please look at the example files MeasurementExample.xls, MeasurementExample.csv in the SBTOOLBOX2/_EXAMPLES folder.

Functions - Full Description and Examples

Installation of Toolbox

installSB
Usage
Installation function for the SBTOOLBOX2. 
Prior to running it you should edit its contents to match your 
system. Standard calling syntax:
 
        >> installSB
 
This function can be called with the optional syntax:
 
        >> installSB('quick')
 
This adds the SBTOOLBOX2 and all subdirectories to the MATLAB 
path. If you are in a computer environment in which MATLAB is
not able to store the path settings you can run this quick 
installation function each time when starting MATLAB. 
 
Note that the quick installation does not build the necessary 
libraries. This is only done by calling installSB without the 
optional argument. Use this the first time when installing a 
new version of the toolbox.
Examples >> installSB

Installs the toolbox, by compiling all needed libraries and functions and setting paths

helpSB
Usage
helpSB: SBTOOLBOX2 help function displaying the web based 
user reference information using the MATLAB web browser. 
To be able to use this function you need to have an active 
internet connection.
 
USAGE:
======
          helpSB
          helpSB 'SBT2 functionname'
 
EXAMPLES:
=========
          helpSB
          helpSB SBsimulate

Model Creation and Handling

output = SBmodel(input)
Usage This function creates an SBmodel.

input=[]
input=[SBmodeldatastructure]
input=[sbm]
input=[SBMLmodelfilename]
input=[Textmodelfilename]

Invoking SBmodel without arguments returns an empty SBmodel. Otherwise SBmodels can be created from a data structure that corresponds to the internal model data structure, described by SBstruct, from a previously defined SBmodel sbm, from an SBML model file SBMLmodelfilename (the extension '.xml' does not need to be specified), and from Textmodelfilename, a text file description of the model. In the latter case the extension '.txt' needs to be specified. The text file description of a model follows the syntax used and defined in SBedit.

The output consists of an SBmodel sbm.

Examples Two example SBML models are provided in the SBTOOLBOX2/_EXAMPLES folder. Change into this folder and type:

>> sbm = SBmodel('SBMLexampleLevel1');

This creates an SBmodel from an SBML model file. Note that to be able to import SBML models you need to have installed the SBMLToolbox (see the Installation Guide).

SBcreateTEXTmodel(input)
Usage
SBcreateTEXTmodel: Creates a new TEXT model, saves the corresponding 
file in the current directory and opens it in the editor, if opening 
is desired.
 
USAGE:
======
SBcreateTEXTmodel(name)
SBcreateTEXTmodel(name,openFlag)
 
name: filename of the model and model name
openFlag: decides if the created model is automatically opened 
          in the editor or not. (=0: do not open, =1: do open)
 
DEFAULT VALUES:
===============
openFlag: 1 (do open)
Examples To create a new TEXT SBmodel with the name newmodel, please enter the following command:

>> SBcreateTEXTmodel('newmodel')

The model is created, saved to the file newmodel.txt, which is subsequently opened in the editor.

SBcreateTEXTBCmodel(input)
Usage
SBcreateTEXTBCmodel: Creates a new TEXTBC model, saves the 
corresponding file in the current directory and opens it in 
the editor, if opening is desired.
 
USAGE:
======
SBcreateTEXTBCmodel(name)
SBcreateTEXTBCmodel(name,openFlag)
 
name: filename of the model and model name
openFlag: decides if the created model is automatically 
          opened in the editor or not. (=0: do not open, 
          =1: do open)
 
DEFAULT VALUES:
===============
openFlag: 1 (do open)
Examples To create a new TEXTBC SBmodel with the name newmodel, please enter the following command:

>> SBcreateTEXTmodel('newmodel')

The model is created, saved to the file newmodel.txtbc, which is subsequently opened in the editor.

output = SBstruct(input)
Usage This function returns the internal data structure of an SBmodel.

input=[sbm]

sbm is the SBmodel for which to return the data structure. output=[SBstructure]

The output consists of the internal data structure of sbm, defined above.

Note that instead of SBstruct also the MATLAB struct command can be used, resulting in exactly the same output.

Examples First run the example from SBmodel above. Then type:

>> SBstructure = SBstruct(sbm)

This returns the internal data structure of the SBmodel.

output = SBedit(input)
Usage This function realizes a graphical user interface that mainly allows to edit an SBmodel using a representation in terms of ODEs, variables, and parameters. The model can directly be simulated, the steady-state can be computed, and the model can be exported to an SBML model and a text file description of the model. The use of SBedit is hopefully self-explanatory due to the help text in each view. For additional information on optional information please type >> help SBedit in MATLAB.

input=[sbm]

sbm: An SBmodel

output = []
output = [sbm]

If no output argument is given, nothing is returned. If an output argument is given, SBedit returns the edited SBmodel.

Examples Change into the SBTOOLBOX2/_EXAMPLES folder and type:

>> sbm = SBmodel('SBMLexampleLevel1.xml')

This converts the SBML model to an SBmodel.

Type the following:

>> SBedit(sbm)

You should just click you around and read the appearing help texts in the top of the window. The window can be resized to desired size.

output = SBeditBC(input)
Usage This function realizes a graphical user interface that mainly allows to edit an SBmodel in terms of a biochemical representation of the reaction equations. The use of parameters, variables, and all other features of the SBmodel is possible. The model can directly be simulated, the steady-state can be computed, and the model can be exported to an SBML model and a text file description of the model. The use of SBeditBC is hopefully self-explanatory due to the help text in each view. For additional information on optional information please type >> help SBeditBC in MATLAB.

input=[sbm]

sbm: An SBmodel

output = []
output = [sbm]

If no output argument is given, nothing is returned. If an output argument is given, SBeditBC returns the edited SBmodel.

Examples Change into the SBTOOLBOX2/_EXAMPLES folder and type:

>> sbm = SBmodel('bcmodel.txtbc')

This converts the biochemically oriented text description of a model into an SBmodel.

Type the following:

>> SBeditBC(sbm)

You should just click you around and read the appearing help texts in the top of the window. The window can be resized to desired size.

Now type:

>> SBedit(sbm)

The biochemically oriented representation and the ODE representation are to 100% interchangeable. Please type >> help SBeditBC and >> help SBedit to find out more.

output = isSBmodel(input)
Usage This function has a single input argument and simply checks if the input argument is an SBmodel. If it is an SBmodel 1 is returned. Otherwise 0.
Examples Not really needed? Otherwise mail me so I can make an example.

output = cleanmodelSB(input)
Usage This function removes unused reactions, variables and parameters from the given SBmodel and returns a "cleaned" SBmodel.

input=[sbm]

sbm: An SBmodel to be cleaned

output = [sbmcleaned]
sbmcleaned: Cleaned SBmodel

Examples Not really needed? Otherwise mail me so I can make an example.

output = SBstates(input)
Usage This function returns information about the states in the model.

input=[model]

model: SBmodel or name of ODE file model

output=[names,ODEs,initialConditions]

names: cell-arry containing the names of the states
ODEs: cell-array containing the right hand sides of the ODEs corresponding to the states (only if model is an SBmodel. In case of an ODE file model this cell-array is returned empty)
initialConditions: vector containing the initial conditions of the states

Examples First run the example from SBmodel above. Then type:

>> [names,ODEs,initialConditions] = SBstates(sbm)

and

>> names = SBstates(sbm)

output = SBinitialconditions(input)
Usage This function returns a column vector with the values of the states in the SBmodel as elements. (The values are the initial conditions stored in the model). The function can also be used to set initial conditions of the model (only if applied to an SBmodel).

[sbm] = SBinitialconditions(sbm,values)

This function call returns an SBmodel sbm which corresponds to the SBmodel sbm with initial conditions for the states as given by values.

[values] = SBinitialconditions(model)

This function call returns the initial conditions for the states set within the model, which is either an SBmodel or a string with the name of an ODE file model.

Examples First run the example from SBmodel above. Then type:

>> SBinitialconditions(sbm)

This returns the initial conditions of the model as stored in sbm.

>> sbm_new = SBinitialconditions(sbm,[1 1 1])

This creates a new SBmodel sbm_new which is the same as sbm, except that it has the specified initial conditions.

output = SBalgebraic(input)
Usage
SBalgebraic: Returns information about the algebraic equations
in a model.
 
USAGE:
======
[names,formulas] = SBalgebraic(model)
 
model: SBmodel or m-file ODE description of model

Output Arguments:
=================
names: Cell-array with names of the variables that are 
       determined using algebraic equations.
formulas: Cell-array with right hand side formula for 
          the algebraic rules.
Examples An example model containing algebraic rules is present in the folder: SBTOOLBOX2/_EXAMPLES/special. Please change into this folder and have a look at the runExamples.m function that will display and simulate the models.

To run the SBalgebraic function you just type:

>> model = SBmodel('example_algebraic_rule.txt')
>> SBalgebraic(model)

output = SBparameters(input)
Usage This function returns information about the parameters in the model.

input=[model]
input=[model, parameters]
input=[model, parameters, newvalues]

model: SBmodel or name of ODE file model (changing parameters is only possible for an SBmodel)
parameters: Name of the parameter for which the value is to be returned or for which a new value is to be set. Alternatively ''parameters'' can be a cell array, containing several parameter names
newvalues: Vector of new parameter values for parameters defined by parameters.

output=[names,values] (in case of a single input argument)
output=[values] (in case of two input arguments)
output=[model] (in case of three input arguments)

names: cell-arry containing the names of the parameters
values: vector containing the values of the parameters
model: SBmodel with changed parameter values

Examples Load the Novak-Tyson cell cycle model by typing:

>> novak_tyson

Then get information about the parameters in the model by typing:

>> [names,values] = SBparameters(sbm)

and

>> names = SBparameters(sbm)

Change parameter k1 by typing

>> sbm = SBparameters(sbm,'k1',1)

output = SBvariables(input)
Usage Returns information about the variables in an SBmodel. If a state vector is passed additionally, the corresponding values of the variables are returned also.

input=[sbm]
input=[sbm,statevector]
input=[sbm,time,statevector]

sbm: SBmodel (function not applicable to an ODE file model)
statevector: Vector with corresponding statevalues
time: Time instant of the statevector (only needed for time variant systems) (default: 0)

output=[names,formulas] (if no statevector is given
output=[names,formulas,variablevalues] (if statevector is given)

names: Cell-array containing the names of the variables
formulas: Cell-array containing the formulas corresponding to the variables
variablevalues: Vector with the values of the variables in the model for the given state and time

Examples First type the following to define a model containing variables (available in the SBTOOLBOX2/_EXAMPLES folder):

>> novak_tyson

this defines an SBmodel with the name sbm. Then type:

>> [names,formulas] = SBvariables(sbm)

and

>> names = SBvariables(sbm)

If you want to determine the values of the models variables at the steady-state, you can type:

>> [names,formulas,variablevalues] = SBvariables(sbm,SBsteadystate(sbm))

Note that for a time-invariant system the specification of the time instant of the given statevector is not needed.

output = SBreactions(input)
Usage
SBreactions: Returns information about the reactions in an SBmodel.
If a state vector is passed additionally, the corresponding 
reaction rates are returned also.
 
USAGE:
======
[names,formulas,reversibleFlag,fastFlag] = SBreactions(model)
[names,formulas,reversibleFlag,fastFlag,reactionrates] =  ...
                                    SBreactions(model,statevector)
[names,formulas,reversibleFlag,fastFlag,reactionrates] = ...
                               SBreactions(model,time,statevector)
 
model: SBmodel (function can not be used on M-file model)
statevector: vector with corresponding statevalues
time: time instant of the statevector (only needed for time 
      variant systems)
 
DEFAULT VALUES:
===============
statevector: not needed 
time: 0  (makes no difference for time invariant systems)
 
Output Arguments:
=================
names: cell-array with models reaction names
formulas: cell-array with formuas for the kinetic laws of the 
          reactions
reversibleFlag: vector with same number of entries as reactions. 
          An entry of 0 indicates an irreversible reaction, an 
          entry of 1 indicates a reversible reaction. The ordering 
          is the same as the reaction names.
fastFlag: vector with same number of entries as reactions. An 
          entry of 1 indicates a fast reaction, an entry of 0 
          indicates a reaction that is determined by its kinetic
          rate law.
reactionrates: the reaction rates at the given state and time
Examples First type the following to define a model containing variables (available in the SBTOOLBOX2/_EXAMPLES folder):

>> novak_tyson

this defines an SBmodel with the name sbm. Then type:

>> [names,formulas,reversibleFlag] = SBreactions(sbm)

and

>> names = SBreactions(sbm)

If you want to determine the values of the reaction rates at the steady-state, you can type:

>> [names,formulas,reversibleFlag,fastFlag,reactionrates] = SBreactions(sbm,SBsteadystate(sbm))

Note that for a time-invariant system the specification of the time instant of the given statevector is not needed.

output = SBfunctions(input)
Usage This function returns information about the functions in an SBmodel.

input=[sbm]

sbm: SBmodel (function not applicable to an ODE file model)

output=[names,formulas,arguments]

names: cell-arry containing the names of the functions
formulas: cell-array containing the formulas corresponding to the functions arguments: cell-array containing the arguments of the corresponding functions

Examples First change to the SBTOOLBOX2/_EXAMPLES folder, then type:

>> sbm = SBmodel('functionsExample.txt')

this defines an SBmodel with the name sbm. Then type:

>> [names,formulas,arguments] = SBfunctions(sbm)

and

>> names = SBfunctions(sbm)

output = SBevents(input)
Usage This function returns information about the events in an SBmodel.

input=[sbm]

sbm: SBmodel (function not applicable to an ODE file model)

output=[names,triggers,variables,formulas]

names: cell-arry containing the names of the events
triggers: cell-array with the assignment variables affected by the events
variables: cell-array containing the arguments of the corresponding functions
formulas: cell-array with the assignment formulas, specifying how to affect the variables if the corresponding event is fired

The ordering of the elements in the cell-arrays is important. The i-th elements in the output variables belongs to the i-th event.

Examples First change to the SBTOOLBOX2/_EXAMPLES folder, then type:

>> sbm = SBmodel('eventExample.txt')

this defines an SBmodel with the name sbm. Then type:

>> [names,triggers,variables,formulas] = SBevents(sbm)

and

>> names = SBevents(sbm)

output = SBfunctionsMATLAB(input)
Usage This function returns information about the functionsMATLAB functions in an SBmodel.

input=[sbm]

sbm: SBmodel (function not applicable to an ODE file model)

output=functionsMATLAB

functionsMATLAB: string containing function definitions written in standard MATLAB code.

Examples First change to the SBTOOLBOX2/_EXAMPLES folder, then type:

>> sbm = SBmodel('functionsMATLABexample.txt')

this defines an SBmodel with the name sbm. Then type:

>> functionsMATLAB = SBfunctionsMATLAB(sbm)

Look at the model using the SBedit function to see what this MATLAB function does and how it is used.

output = isparameterSB(input)
Usage This function checks if a given "name" is a parameter in given model.

input=[sbm, name]

sbm: SBmodel or ODE file model
name: parameter name to test (string)

output=flag

flag: 0 = no parameter with given name present. 1 = parameter with given name is present in the model.

Examples Not really needed? Otherwise mail me so I can make an example.

output = isstateSB(input)
Usage This function checks if a given "name" is a state in given model.

input=[sbm, name]

sbm: SBmodel or ODE file model
name: state name to test (string)

output=flag

flag: 0 = no state with given name present. 1 = state with given name is present in the model.

Examples Not really needed? Otherwise mail me so I can make an example.

output = isvariableSB(input)
Usage This function checks if a given "name" is a variable in given model.

input=[sbm, name]

sbm: SBmodel or ODE file model
name: variable name to test (string)

output=flag

flag: 0 = no variable with given name present. 1 = variable with given name is present in the model.

Examples Not really needed? Otherwise mail me so I can make an example.

output = isreactionSB(input)
Usage This function checks if a given "name" is a reaction in given model.

input=[sbm, name]

sbm: SBmodel or ODE file model
name: reaction name to test (string)

output=flag

flag: 0 = no reaction with given name present. 1 = reaction with given name is present in the model.

Examples Not really needed? Otherwise mail me so I can make an example.

output = stateindexSB(input)
Usage This function returns the index of a specified state in the given model.

input=[sbm, name]

sbm: SBmodel or ODE file model
name: state name to obtain the index for (string)

output=index

index: =[]: specified name is not a state in the given model. Otherwise it contains the index of the state in the model.

Examples Not really needed? Otherwise mail me so I can make an example.

output = variableindexSB(input)
Usage This function returns the index of a specified variable in the given model.

input=[sbm, name]

sbm: SBmodel or ODE file model
name: variable name to obtain the index for (string)

output=index

index: =[]: specified name is not a variable in the given model. Otherwise it contains the index of the variable in the model.

Examples Not really needed? Otherwise mail me so I can make an example.

output = reactionindexSB(input)
Usage This function returns the index of a specified reaction in the given model.

input=[sbm, name]

sbm: SBmodel or ODE file model
name: reaction name to obtain the index for (string)

output=index

index: =[]: specified name is not a reaction in the given model. Otherwise it contains the index of the reaction in the model.

Examples Not really needed? Otherwise mail me so I can make an example.

output = usedelaySB(input)
Usage
usedelaySB: checks if an SBmodel contains the delaySB function.
 
output = usedelaySB(model)
 
model: SBmodel
 
Output Arguments:
=================
output: =1 if "delaySB" function is present in the model, =0 if not
	
Examples An example model containing delays is present in the folder: SBTOOLBOX2/_EXAMPLES/special. Please change into this folder and have a look at the runExamples.m function that will display and simulate the models.

To run the usedelaySB function you just type:

>> model = SBmodel('example_delay.txt')
>> usedelaySB(model)

output = useeventSB(input)
Usage
useeventSB: checks if an SBmodel contains events.
 
output = useeventSB(model)
  
model: SBmodel
 
Output Arguments:
=================
output: =1 if events are present in the model, =0 if not
	
Examples An example model containing delayed events is present in the folder: SBTOOLBOX2/_EXAMPLES/special. Please change into this folder and have a look at the runExamples.m function that will display and simulate the models.

output = usealgebraicSB(input)
Usage
usealgebraicSB: checks if an SBmodel contains algebraic rules.
 
output = usealgebraicSB(model)
  
model: SBmodel
 
Output Arguments:
=================
output: =1 if algebraic rules present in the model, =0 if not
	
Examples An example model containing algebraic rules is present in the folder: SBTOOLBOX2/_EXAMPLES/special. Please change into this folder and have a look at the runExamples.m function that will display and simulate the models.

To run the usealgebraicSB function you just type:

>> model = SBmodel('example_algebraic_rule.txt')
>> usealgebraicSB(model)

output = usefastSB(input)
Usage
usefastSB: Checks if an SBmodel contains "fast" reactions.
 
output = usefastSB(model)

model: SBmodel

Output Arguments:
=================
output: =1 if reactions with the "fast" flag set are present,
        =0 if not
	
Examples An example model containing fast reactions is present in the folder: SBTOOLBOX2/_EXAMPLES/special. Please change into this folder and have a look at the runExamples.m function that will display and simulate the models.

To run the usefastSB function you just type:

>> model = SBmodel('example_fast_reaction.txtbc')
>> usefastSB(model)

output = hasmoietyconservationsSB(input)
Usage
hasmoietyconservationsSB: Checks if an SBmodel contains 
moiety conservations.
 
output = hasmoietyconservationsSB(model)

model: SBmodel

Output Arguments:
=================
output: =1 if moiety conservations are present, =0 if not
	
Examples Not really needed? Otherwise mail me so I can make an example.

Experiment Creation and Handling

output = SBexperiment(input)
Usage This function creates an SBexperiment object, defining experiment settings.

input=[]
input=[SBstructure]
input=[expin]
input=["filename".exp]

Invoking SBexperiment without arguments returns an empty SBexperiment object. Otherwise SBexperiment objects can be created from a data structure that corresponds to the internal experiment data structure, from a previously defined SBexperiment object expin, and from an experiment description file "filename".exp (the extension '.exp' is mandatory).

The output consists of an SBexperiment object exp.

Examples Please have a look at the contents of the SBTOOLBOX2/_EXAMPLES/experiment folder, which contains an example model, experiment and a short script combining model and experiment. The defined experiment uses all features and contains the documentation of the syntax.

output = SBstruct(input)
Usage This function returns the internal data structure of an SBexperiment object.

input=[exp]

exp is the SBexperiment object for which to return the data structure. output=[SBstructure]

The output consists of the internal data structure of exp, defined above.

Note that instead of SBstruct also the MATLAB struct command can be used, resulting in exactly the same output.

Examples Should be self-explaining.

SBcreateEXPfile(input)
Usage This function converts an SBexperiment object to a text file description that is written in the current directory.

input=[exp]
input=[exp, filename]

The only required input is an SBexperiment object exp that is to be converted to an experiment text file description. The second input argument is optional and determines the filename of the EXP file. If the filename is not given the content of the experiments name field is used as filename.

Examples Should be self-explaining.

output = SBmergemodexp(input)
Usage This function merges an SBmodel with an SBexperiment object. The result is a merged SBmodel that can be simulated and will reflect the nominal models behavior under the experimental conditions that are defined in the experiment description.

input=[sbm,exp]

sbm: An SBmodel
exp: An SBexperiment object

output=[expmodel]

expmodel: An SBmodel in which the model (sbm) and the experiment (exp) have been merged.

Examples Please have a look at the contents of the SBTOOLBOX2/_EXAMPLES/experiment folder, which contains an example model, experiment and a short script combining model and experiment. The defined experiment uses all features and contains the documentation of the syntax.

output = isSBexperiment(input)
Usage This function has a single input argument and simply checks if the input argument is an SBexperiment. If it is an SBexperiment 1 is returned. Otherwise 0.
Examples Not really needed? Otherwise mail me so I can make an example.

Measurement Creation and Handling

output = SBmeasurement(input)
Usage This function creates an object that contains measurement data from real experiments or insilico computations.

input = []
input = [SBmeasurementstructure]
input = [SBmeasurement]
input = [filename]

SBmeasurementstructure: Internal measurement data structure, used for representation of an SBmeasurement object.
SBmeasurement: An SBmeasurement object.
filename: A CSV (comma separated values) file or an Excel file. CSV files have the extension *.csv, Excel files *.xls (case sensitive!).

output: The output can be a new SBmeasurement object. In the case that several measurements are represented in the same Excel file (on separate sheets), the output is a cell-array where each element is an SBmeasurement object.

Examples Example Excel and CSV data files are provided in the SBTOOLBOX2/_EXAMPLES folder. Change into this folder and type:

>> measurements = SBmeasurement('MeasurementExample.xls');

This creates SBmeasurement objects from an Excel file. In the above Excel file 2 measurements are stored. Each on a separate sheet. The output measurements is thus a cell-array with 2 elements. Each element is an SBmeasurement object. Have also a look at the Excel file to get an idea of how it is formatted.

A corresponding CSV example is the following:

>> measurement = SBmeasurement('MeasurementExample.csv');

In CSV files only single measurements can be present and the output is thus always an SBmeasurement object.

output = SBstruct(input)
Usage This function returns the internal data structure of an SBmeasurement object.

input=[SBmeasurement]

SBmeasurement is the SBmeasurement object for which to return the data structure. output=[SBmeasurementstructure]

The output consists of the internal data structure of the SBmeasurement object, defined above.

Note that instead of SBstruct also the MATLAB struct command can be used, resulting in exactly the same output.

Examples Change into the SBTOOLBOX2/_EXAMPLES folder. Then type:

>> measurements = SBmeasurement('MeasurementExample.xls')
>> datastructure = SBstruct(measurements{1})

output = SBmeasurementdata(input)
Usage
This functions allows to extract information from an SBmeasurement 
structure

USAGE:
======
[time, componentNames] = SBmeasurementdata(measurement)
[time, componentNames, values] = SBmeasurementdata(measurement)
[time, componentNames, values,minvalues,maxvalues] = 
	SBmeasurementdata(measurement)
 
measurement: SBmeasurement object
 
Output Arguments:
=================
time: time vector of all measurement instants
componentNames: cell-array containing the names of the measured
  components
values: matrix containing all the measurements of the components.
  One row per time instant and one column per measured component.
  The ordering of the columns corresponds to the ordering of the
  names in the "componentNames" output variable. Non measured
  elements are set to NaN (not a number).
minvalues: matrix containing all the min values for the measured
  components. One row per time instant and one column per measured
  component. The ordering of the columns corresponds to the
  ordering of the names in the "componentNames" output variable.
  Non measured elements are set to NaN (not a number).
maxvalues: matrix containing all the max values for the measured
  components. One row per time instant and one column per measured
  component. The ordering of the columns corresponds to the
  ordering of the names in the "componentNames" output variable.
  Non measured elements are set to NaN (not a number).
Examples Change into the SBTOOLBOX2/_EXAMPLES folder. Then type:

>> measurement = SBmeasurement('MeasurementExample.csv');

Information about the components present in the SBmeasurement object can be obtained by writting:

>> [time, names, values] = SBmeasurementdata(measurement)

SBexportCSVmeasurement(input)
Usage Exports an SBmeasurement object to a CSV (comma separated value) file. The format of the written CSV file is explained above.

input = [SBmeasurement]
input = [SBmeasurement,filename]

SBmeasurement: SBmeasurement object containing the data.
filename: Desired filename for CSV file. The extension .csv is not required.

If no filename is specified, the filename is constructed from the name of the data object.

Examples Change into the SBTOOLBOX2/_EXAMPLES folder. Then type:

>> measurement = SBmeasurement('MeasurementExample.csv');

The SBmeasurement object can be exported to a CSV file by typing

>> SBexportCSVmeasurement(measurement,'ExportData');

SBexportXLSmeasurement(input)
Usage Exports an SBmeasurement object to an Excel file. The format of the written XLS file is explained above.

input = [SBmeasurement]
input = [SBmeasurement,filename]
input = [SBmeasurement,filename,sheet]

SBmeasurement: SBmeasurement object containing the data.
filename: Desired filename for XLS file. The extension .xls is not required. If no filename is specified, the filename is constructed from the name of the data object.
sheet: Number of the Excel sheet to which to export the measurement data.

Examples Change into the SBTOOLBOX2/_EXAMPLES folder. Then type:

>> measurement = SBmeasurement('MeasurementExample.csv');

The SBmeasurement object can be exported to an XLS file by typing

>> SBexportXLSmeasurement(measurement,'ExportData2');

SBexportXLSmeasurements(input)
Usage Exports several SBmeasurement objects to an Excel file. Each measurement to a separate Excel sheet. The format of the written XLS file is explained above.

input = [measurements,filename]

measurements: Cell-array containing SBmeasurement objects.
filename: Desired filename for XLS file. The extension .xls is not required. If no filename is specified, the filename is constructed from the name of the data object.

Examples Change into the SBTOOLBOX2/_EXAMPLES folder. Then type:

>> measurements = SBmeasurement('MeasurementExample.xls');

The cell array with the SBmeasurement objects can be exported to an XLS file by typing

>> SBexportXLSmeasurements(measurements,'ExportData2');

output = SBvisualizemeasurement(input)
Usage This function can be used to graphically visualize data stored in an SBmeasurement object. The function used for plotting is SBplot.

input = [measurement]

measurement: SBmeasurement object containing the data.

If an output argument is specified, the data are not plotted, but a structure is returned that can be used as input argument for SBplot to show the data.

Examples Change into the SBTOOLBOX2/_EXAMPLES folder. Then type:

>> measurement = SBmeasurement('MeasurementExample.csv');

The contents of the SBmeasurement object can be visualized by typing

>> SBvisualizemeasurement(measurement)

The circles mark the instants at which measurements are present in the data. In the legend the name/formula of the measurements and (if present) the component notes are shown.

If an output argument is specified the function does not plot the results but returns a structure, that can be used for plotting by SBplot.

>> output = SBvisualizemeasurement(measurement)
>> SBplot(output)

output = isSBmeasurement(input)
Usage This function has a single input argument and simply checks if the input argument is an SBmeasurement object. If it is an SBmeasurement object 1 is returned. Otherwise 0.
Examples Not really needed? Otherwise mail me so I can make an example.

Export of SBmodel

SBcreateODEfile(input)
Usage This function converts an SBmodel to a MATLAB ODE file that is written in the current directory.

input=[sbm]
input=[sbm, filename]
input=[sbm, filename,dataFileFlag]
input=[sbm, filename,dataFileFlag,eventFlag]

The only required input is an SBmodel sbm that is to be converted to an ODE file. The second input argument is optional and determines the filename of the ODE file. If the filename is not given the content of the models name field is used as filename.

The optional argument eventFlag indicates (if set to one) that the SBcreateODEfile function should also create an event handling function and an event assignment function. These functions are required for the simulation of models that contain discrete state events. If not specified otherwise this flag is zero per default. The optional argument dataFileFlag has the following meaning: dataFileFlag=1: an additional file is created allowing to determine variable and reaction rate values for given state values and time vector. If set to 0, no such file is created (default).

Examples Load the Novak-Tyson cell cycle model by typing:

>> novak_tyson

Create the ODE file and the datafile from the SBmodel.

>> SBcreateODEfile(sbm,'example', 1);

To simulate the ODE file and visualize the results type:

>> initialConditions = example();
>> [t,x] = ode15s(@example,[0 400],initialConditions);
>> plot(t,x);

This only determined the trajectories for the states of the model. To determine also the trajectories of the reaction rates and the variables type:

>> help datafile_example
>> output = datafile_example(t,x)

The variable output is a MATLAB structure with the result of the simulation. Please inspect this structure to see what it contains. Compare it also to the result from:

>> output = SBsimulate(sbm,400)

output = SBcreateTempODEfile(input)
Usage This function creates a temporary ODE file, same as SBcreateODEfile, but the file is written in the systems temporary directory. It creates also a datafile and eventhandling files if wanted. No filename is passed, but temporary filenames/functionnames are chosen automatically and returned back as output argument. Since the function also includes the path to the systems temporary directory in the MATLAB path the returned functionnames can be used directly. For example, for simulation using the MATLAB integrators.

input=[sbm]
input=[sbm, dataFileFlag]
input=[sbm, dataFileFlag, eventFlag]

sbm: SBmodel to convert to an ODE file description
dataFileFlag: =1: creates an additional file allowing to determine variable and reaction rate values for given state values and time vector. =0: does not create the additional file (default).
eventFlag: =1: creates 2 additional files for the handling of events in the model. =0: does not create these two files (default).

output = [ODEfctname, ODEfilefullpath, DATAfctname, EVENTfctname, EVENTASSGNfctname]

ODEfctname: Name of the function (filename without .m extension)
ODEfilefullpath: Complete path to the created ODE file (including .m extension) DATAfctname: Name of the datafile function (filename without .m extension)
EVENTfctname: Name of the event function (filename without .m extension)
EVENTASSGNfctname: Name of the event assignment function (filename without .m extension)

The names of the data and event functions are returned as empty string in the case that the corresponding flags are set to 0.

deleteTempODEfileSB(input)
Usage This function should be used to delete the created temporary files, created using the function SBcreateTempODEfile, after having been used. It not only deletes the ODE file, but also the data and event handling files, if present.

input=[ODEfilefullpath]

ODEfilefullpath: The variable of the same name, returned by SBcreateTempODEfile.

SBcreateTEXTfile(input)
Usage This function converts an SBmodel to a file containing a textual description of the model in terms of ODEs. This textfile can then be loaded as SBmodel using SBmodel. Please note that the extension of such a file is .txt.

input=[sbm]
input=[sbm, filename]

The only required input is an SBmodel sbm that is to be converted to a textfile. The second input argument is optional and determines the filename of the textfile. If the filename is not given the content of the models name field is used as filename.

Examples First run the example from SBmodel above. Then type:

>> SBcreateTEXTfile(sbm,'example');

This command takes the SBmodel sbm as input an exports it into a textfile example.txt. You can load the textfile again into an SBmodel by typing:

>> model = SBmodel('example.txt')

SBcreateTEXTBCfile(input)
Usage This function converts an SBmodel to a file containing a textual description of the model in terms of reaction equations. This textfile can then be loaded as SBmodel using SBmodel. Please note that the extension of such a file is .txtbc.

input=[sbm]
input=[sbm, filename]

The only required input is an SBmodel sbm that is to be converted to a textfile. The second input argument is optional and determines the filename of the textfile. If the filename is not given the content of the models name field is used as filename.

Examples Change into the SBTOOLBOX2/example folder. Then type

>> edit bcmodel.txtbc

This is a model in the TEXTBC format. You easily see the difference to the TEXT format, which is based on ODEs. To load the model type:

>> model = SBmodel('bcmodel.txtbc');

To export the model again as a TEXTBC file type:

>> SBcreateTEXTBCfile(model,'test');

SBexportSBML(input)
Usage This functions exports an SBmodel to an SBML model file.

input=[sbm]

The only required input is an SBmodel sbm that is to be exported to an SBML model. In order to be able to correctly export an SBmodel to SBML additional information in the the type, compartment, and unittype fields in the SBmodel's internal datastructure are needed. The SBexportSBML function determines this information automatically if not already present.
To learn more about how this additional information can be set manually already in the models text description, please have a look at the MATLAB help text for SBedit, or SBeditBC

Examples Change into the SBTOOLBOX2/example folder and type:

>> sbm = SBmodel('SBMLexampleLevel1.xml')

This converts the SBML model to an SBmodel. The sbmlnotes fields are already set correctly.

>> SBexportSBML(sbm)

This exports the SBmodel to an SBML model of level 2. In order to get an idea about the needed contents of the sbmlnotes fields in the internal data structure, type the following:

>> SBedit(sbm)

and click once on the Export SBML button.

An example for a model, for which the additional information is not yet present, can be run by the following commands:

>> novak_tyson

This is a script that defines a simple example model. Typing SBedit(sbm) it can be visualized.

To convert it to SBML please type:

>> SBexportSBML(sbm)

output = SBconvert2MA(input)
Usage This function takes an SBmodel and if possible returns the stoichiometric matrix, the numeric kinetic parameters, and the initial conditions. The SBmodel is not allowed to contain variables, functions, events, or functionsMATLAB. All right hand sides of the ODEs have to be defined in terms of reaction names (see also SBstoichiometry). All reactions need to be irreversible.

Please note that the function is NOT parsing the reaction kinetics to check if they are correct mass action kinetic rate laws. The user needs to make sure that this is the case. Examples of correct expressions are:

Reaction = k * species1 * species2
Reaction = species1 * species2 * k
Reaction = k * species1
Reaction = 3.141592 * species1^2
Reaction = species1^2

The kinetic rate constant is then simply determined by setting all species concentrations to 1 and evaluating the rate expressions.

input = [model]

model: SBmodel

output = [MAstructure]

The MAstructure output argument has the following structure:
MAmodel.N: Stoichiometric matrix
MAmodel.L: Reactant stoichiometric matrix
MAmodel.kineticParameters: Vector containing the kinetic parameters for each reaction
MAmodel.initialConditions: Vector of initial conditions for all species
MAmodel.species: Cell-array with species names
MAstructure.reactions: Cell-array with reaction names

Examples Change into the SBTOOLBOX2/example folder and type:

>> model = SBmodel('bcmodel.txtbc')
>> MAstructure = SBconvert2MA(model)

Simulation Functions

output = SBsimulate(input)
Usage This function simulates an SBmodel or an ODE file created by SBcreateODEfile. In case the model is given as an SBmodel, not only the trajectories for the models states are determined, but also the time trajectories for all variables and reaction rates in the model.

input=[model]
input=[model, time]
input=[model, method, time]
input=[model, method, time, ic]
input=[model, method, time, ic, options]

model: SBmodel or string with name of ODE file to be simulated
time: (1) Scalar value for simulation end time (default start time is 0, default end time is 20), (2) vector with two elements indicating start and end time, or (3) vector with time instants for which the simulation results are to be returned.
method: String determining a MATLAB integrator, e.g., method='ode23s' (ode23s is the default integrator)
ic: Vector of initial conditions (the initial conditions stored in the model are used as default values)
options: Standard MATLAB integrator options set by odeset (default options correspond to options=[])

If no output arguments are given, the result of the simulation is plotted 1) online during the simulation for monitoring purposes - the simulation can here be stopped at every instant by just clicking on the "Stop" button. 2) after the simulation is finished the simulation data is plotted using the SBplot function, allowing to browse the simulation data.

In case an output argument is specified (e.g., output), the following structure is returned:

output.time: Vector with time instants for the results
output.states: Cell-array with state names
output.statevalues: Matrix with state values. Each row corresponds to one time instant.

The following fields are only present in case the model as been given as an SBmodel:

output.variables: Cell-array with variable names
output.variablevalues: Matrix with variable values. Each row corresponds to one time instant.
output.reactions: Cell-array with reaction names
output.reactionvalues: Matrix with reaction values. Each row corresponds to one time instant.

Examples First run the example from SBmodel above. Then type:

>> SBsimulate(sbm)

This simulates the SBmodel sbm from 0 to 20 time units using the initial conditions in sbm and the MATLAB ode23s integrator. The result is plotted using SBplot.

>> output = SBsimulate(sbm,'ode45',[0 100],[1 1 1])

This simulates the SBmodel sbm from 0 to 100 time units from the given initial conditions and the MATLAB ode45 integrator. The result is returned as a structure in output.

output = SBstochsim(input)
Usage
Stochastic simulation of SBmodels that only contain mass
action kinetics. The simulator is based on the paper:
Ullah, M., Schmidt, H., Cho, K.-H., Wolkenhauer, O. (2006) 
Deterministic Modelling and Stochastic Simulation of Pathways 
using MATLAB, IEE Proceedings - Systems Biology, 153(2), 53-60
 
The SBmodel needs to have a certain format, explained below.
 
USAGE:
======
[output] = SBstochsim(model,time,V)         
[output] = SBstochsim(model,time,V,units)         
[output] = SBstochsim(model,time,V,units,runs)         
[output] = SBstochsim(model,time,V,units,runs,Nsample)         
 
model:   SBmodel 
         There are certain limitations on an SBmodel used for 
         stochastic simulation. Please read further below.
V:       Volume/NumbersFlag: If a number is given then this number 
         is in interpreted as the volume of the reaction space 
         (given in Liter). This is necessary in order to do 
         stochastic simulations if the species in the model are in 
         concentration units. If the species in the model are given 
         in molecule numbers, the volume is not important and this 
         is indicated by setting V to [].
units:   This value is only used in the case that the species 
         are defined in concentration units. Per default nM 
         (units=1e-9) are assumed for all species. If the model uses 
         uM the units argument needs to be set to 1e-6, etc. 
         (default: 1e-9 used only if V has a numeric value) 
time:    End time for simulation 
runs:    number of realizations(simulation runs) (default: 1)
Nsample: Each Nsample-th point will be used for output 
         (to save memory) (default: 100)
 
Output Arguments:
=================
If no output arguments are given, the result of the simulation is
plotted (if runs>1 only the mean is plotted). Otherwise the output
argument has the following structure:

output.time:            cell-array with time vectors for the single 
                        runs 
output.speciesdata:     cell-array with simulation data for the 
                        single runs
output.runs:            number of runs
output.timemean:        ensemble of all time instants in the 
                        single runs
output.speciesdatamean: matrix containing the means of the 
                        simulation data
output.species:         cell-array containing the names of the 
                        species
 
FORMAT OF THE SBmodel:
======================
SBmodels that can be used for stochastic simulation need to 
follow some rules:
1) All reaction kinetics need to be of mass action type and be 
   defined in the following syntax:
   
           'ReactionName' = 'kineticParameter' * ...

2) All reactions have to be irreversible. You can use the 
   function SBmakeirreversible to convert your model
3) The reactions can at maximum have 2 substrates and 2 products.
4) The right hand side of the ODEs needs only to consist of 
   reaction rate terms and eventually stoichiometric coefficients.
   This is necessary in order to be able to determine the  
   stoichiometric matrix. More information about the required 
   syntax can be found in the help text of the function 
   SBstoichiometry
5) No variables, functions, events, functionsMATLAB are allowed to 
   be present.
6) Initial conditions of species are assumed to be given in numbers 
   of molecules
Examples Please change into the SBTOOLBOX2/_EXAMPLES folder.

>> model = SBmodel('stochexample.txtbc');

This loads a model that is based on the model published in: Unified phototransduction model from Hamer et al., Visual Neuroscience 22, 417-436. The model has been modified considerably to test the rhodopsin shut-off kinetics.

>> time = 20
>> volume = [] % since species in numbers
>> units = [] % since species in numbers
>> runs = 1 % single run
>> Nsample = 1 % each reaction event is reported
>> SBstochsim(model,time,volume,units,runs,Nsample)

Plotting Functions

SBplot(input)
Usage This function has a graphical user interface. It allows to plot simulation data returned from a MATLAB integrator or from SBsimulate. It has no output arguments. The use of it is self-explanatory. Several datasets can be handled and selected. Apart from only plotting the data on different axes settings (lin,linlog,log, etc.) the SBplot GUI also allows to display the fourier transform and the autocorrelation of selected signals.

Per default the mean value is substracted before the computation of the FFT and the autocorrelation. For the FFT this can be overridden by setting the global variable doRemoveZeroComponentFlag to 0 before calling SBplot.

input = [time,data]
input = [time,data,names]
input = [time,data,names,name]
input = [time,data,names,legendtext,name]
input = [time,data,names,legendtext,marker,name]
input = [time,data,names,errorindices,minvalues,maxvalues,... legendtext,marker,name]

input = [datastruct1]
input = [datastruct1,datastruct2]
input = [datastruct1,datastruct2, ..., datastructN]

The datastructures are created most easily using the function createdatastructSBplotSB.

time: Column vector with time information
data: Matrix with data where each row corresponds to one time point and each column to a different variable.
names: Cell-array with the names of the data variables (default: 'x1','x2', ...).
legendtext: Cell-array of same length as names with text to be used for the legend (default: same as names).
marker: Marker and line style for plot (default: '-').
errorindices: Indices of the data for which errorbounds are available.
minvalues: Error bounds for data ... to be shown by error bars (default: no errorbars shown).
maxvalues: Error bounds for data ... to be shown by error bars (default: no errorbars shown).
name: Name, describing the dataset.

datastruct: datastructure with all the plotting data (allows for displaying several datastructs at a time in the same GUI).

Examples First run the example from SBmodel above. Then type:

>> SBsimulate(sbm)

This simulates the SBmodel and plots the result using SBplot. Try also

>> output = SBsimulate(sbm)
>> SBplot(output.time,output.statevalues,output.states)

This first simulates the model and returns the simulation data in a structure. Then SBplot is used to plot the states over time.

SBplot2(input)
Usage This function has a graphical user interface. It allows to plot data that is best visualized using bar graphs. The user can customize axis titles, and visualize several different data sets at a time. A simple export functionality allows to construct figures containing subplots.

input = [datastruct1]
input = [datastruct1,datastruct2]
input = [datastruct1,datastruct2, ..., datastruct10]

datastruct1-10: Structure with information about the datasets that are to be displayed. SBplot2 can accept up to 10 different datastructures which can be displayed. The structure of the input arguments is defined as follows:

datastruct.name: Descriptive name for the datastructure
datastruct.xnames: Cell-array with names of x-axis data
datastruct.ynames: Cell-array with names of y-axis data
datastruct.data: Matrix with y-axis data in rows and x-axis data in columns
datastruct.title: A title for the plot
datastruct.xlabel: Label for the x-axis
datastruct.xaxistitle: Text describing the x-axis selection box
datastruct.yaxistitle: Text describing the y-axis selection box

All fields of the structure need to be correctly initialized.

Examples For examples please execute the examples given for the parameter sensitivity analysis functions.

output = createdatastructSBplotSB(input)
Usage This function allows to pack the standard input argument of the SBplot function into a datastructure that also can be used as input argument for the SBplot function. The advantage is that the SBplot function then can take several of these structures as input arguments and allows to browse all the different plots.

input = [time,data]
input = [time,data,names]
input = [time,data,names,name]
input = [time,data,names,legendtext,name]
input = [time,data,names,legendtext,marker,name]
input = [time,data,names,errorindices,minvalues, ... maxvalues,legendtext,marker,name]

time: Column vector with time information
data: Matrix with data where each row corresponds to one time point and each column to a different variable.
names: Cell-array with the names of the data variables (default: 'x1','x2', ...).
legendtext: Cell-array of same length as names with text to be used for the legend (default: same as names).
marker: Marker and line style for plot (default: '-').
errorindices: Indices of the data for which errorbounds are available.
minvalues: Error bounds for data ... to be shown by error bars (default: no errorbars shown).
maxvalues: Error bounds for data ... to be shown by error bars (default: no errorbars shown).
name: Name, describing the dataset.

The output is a datastructure that can be passed to SBplot.

Examples >> novak_tyson % this generates the Novak Tyson model in the workspace.
>> output = SBsimulate(sbm)
>> data1 = createdatastructSBplotSB(output.time,output.statevalues, ... output.states,'All the states');
>> data2 = createdatastructSBplotSB(output.time,output.reactionvalues, ... output.reactions,'All the reactions');
>> data3 = createdatastructSBplotSB(output.time,output.variablevalues, ... output.variables,'All the variables');
>> SBplot(data1,data2,data3)

Note that you can change between the datasets in the upper left corner of the SBplot window.

output = createdatastruct2SBplotSB(input)
Usage
createdatastruct2SBplotSB: Converts simulation data, 
returned from SBsimulate or SBPDsimulate to a datastruct that 
can be passed to SBplot for plotting.
 
USAGE:
======
[datastruct] = createdatastruct2SBplotSB(simdata)
[datastruct] = createdatastruct2SBplotSB(simdata,name)
 
simdata: simulation data returned by SBsimulate and SBPDsimulate
name: name for the datastruct
   
DEFAULT SETTINGS:
=================
name: 'unnamed'
 
Output Arguments:
=================
datastruct: structure that can be displayed by SBplot   
            (>> SBplot(datastruct))
Examples >> novak_tyson % get Novak Tyson model in the workspace.
>> simdata = SBsimulate(sbm)
>> datastructure = createdatastruct2SBplotSB(simdata);
>> SBplot(datastructure)

Simple Analysis Functions

output = SBsteadystate(input)
Usage This function determines the steady-state of a model given as SBmodel or as ODE file, created by SBcreateODEfile. The function is limited to time-invariant models. Otherwise an error will occur. The function is able to deal with models having a singular Jacobian, e.g., due to moiety conservations.

input=[model]
input=[model, initialConditions]
input=[model, initialConditions, OPTIONS]

model: SBmodel or string with name of ODE file
initialConditions: The initial conditions from where to search for the steady-state. If not given the initial conditions are taken from the SBmodel or the ODE file.
OPTIONS: structure containing options
OPTIONS.TolFun: Tolerance for max element in function evaluation (default: 1e-11).
OPTIONS.tol: Tolerance for the determination of the number of algebraic relationships in the model. If the method fails than this might be due to a wrong rank computation and in this case the tolerance should be increased. If set, the same tolerance setting is used when determining the indices of the dependent variables (default: standard MATLAB tolerance: s = svd(A); tol = max(size(A))*eps(max(s))).
OPTIONS.MaxIter: Maximum number of iterations (default: 1000).
OPTIONS.Delta: Step length for numerical differentiation to obtain the Jacobian (default: 1e-6).

output=[steadystate]
output=[steadystate, residual]
output=[steadystate, residual, message]

steadystate: Vector with the steady-state values. If steady-state could not be found steadystate=[].
residual: 2-norm of the derivatives at the found steady-state. If steady-state could not be found residual=[].
message: If not specified as output argument, an eventual message is printed in the MATLAB window instead.

Examples First define a model by typing:

>> novak_tyson

Then determine a steady-state by typing:

>> [steadystate, residual] = SBsteadystate(sbm)

This determines the steady-state and the residual for the SBmodel sbm, starting the search at the initial conditions given in sbm, using default options for the solver and nominal values for the parameters.

output = SBjacobian(input)
Usage Determines the Jacobian of a given SBmodel or an ODE file description. The Jacobian is obtained by numerical differentiation around a given state. This function should only be used for time-invariant systems. If used for time-variant systems an error will occur.

input=[model,state]
input=[model,state,delta]

model: SBmodel or string with name of ODE file for which to determine the Jacobian.
state: Vector of state values at which to determine the Jacobian.
delta: Stepsize used for numerical differentiation (default = 1e-6).

output=[jacobian]
output=[jacobian,statenames]

jacobian: Jacobian of the model at the given state.
statenames: MATLAB cell-array with the names of the states of the model.

Examples First define a model by typing:

>> novak_tyson

Then determine the Jacobian at the state corresponding to the initial conditions stored in the model by typing:

>> Jacobian = SBjacobian(sbm,SBinitialconditions(sbm))

[output] = SBmoietyconservations(input)
Usage This function determines algebraic relationships, present in a given model. These algebraic relations can be due to moitey conservations and other conservation laws. The model can be specified as SBmodel or as ODE file.

input = [model]
input = [model, stateValues]
input = [model, stateValues, tol]

model: SBmodel or ODE file model description.
stateValues: Values of the state variables for which to perform the analysis.
tol: Tolerance for the determination of the number of algebraic relationships in the model. If the method fails than this might be due to a wrong rank computation and in this case the tolerance should be increased. If set, the same tolerance setting is used when determining the indices of the dependent variables.

When no output arguments are specified the function will simply display the found algebraic relations in the MATLAB window.

output = [depVarIndex, depVarConstant, depVarFactor, message]

depVarIndex: Index of dependent states
depVarConstant: Sum of states taking part in conservation
depVarFactor: Factor for states - non-zero values for the ones that take part in conservation
message: Any message that otherwise is printed to the MATLAB window

Examples An example SBML model is provided in the SBTOOLBOX2/_EXAMPLES folder. Change into this folder and type:

>> sbm = SBmodel('testsingular');
>> SBmoietyconservations(sbm)

SBreducemodel(input)
Usage Reduces an SBmodel by identifying algebraic relations in its ODEs and deleting the corresponding time dependent variables. The function first checks if the SBmodel contains algebraic relations between the time dependent variables. If there are, it lets the user decide which variables to delete and replaces these by static variables. Due to moiety conservations algebraic relations are often present in biological systems. However, many analysis methods require non-singular systems. This function helps to avoid this problem.

input = [sbm]

sbm: SBmodel to reduce (not applicable to ODE file model descriptions)

output = [sbmreduced]

sbmreduced: Reduced SBmodel. If sbm is non-singular, sbmreduced = sbm

Examples An example SBML model is provided in the SBTOOLBOX2/_EXAMPLES folder. Change into this folder and type:

>> sbm = SBmodel('testsingular');
>> sbmreduced = SBreducemodel(sbm);

This command performs the reduction of sbm. It first displays the 2 algebraic relations that are present in the ODEs of the model. Then, for each algebraic relation, it lets the user decide which variable to delete and to replace by a static variable. The function returns an SBmodel with only 4 states. You can now simulate the two models to see the difference:

>> SBsimulate(sbm)
>> SBsimulate(sbmreduced)

[output] = SBstoichiometry(input)
Usage Determines the stoichiometric matrix for the given model. In order to be able to do that the differential equations for the components have to be expressed in terms of reaction rates. The stoichiometric constants need to be numeric and multiplied to the reaction terms. Example:

d/dt(A) = -1*Re1+2*Re3-Re5+3.141*Re8

Especially when importing models from SBML the right hand side of the ODEs might show a correction term that is needed for transport between two different compartments in the case that the species is defined in concentration units. In this case the ODE can look as follows:

d/dt(B): (-1*Re1+2*Re3-Re5+3.141*Re8)/compartmentsize

This syntax is also accepted. In this case the stoichiometric elements in the parenthesis will be divided by compartmentsize.

The compartmentsize is only allowed to be a parameter! It can not be a numeric value, a state, a variable, or a function!

Except the above shown pair of parentheses, no additional parentheses are allowed to appear in the ODE definitions. Otherwise, and in case that not only reaction rates are present in the ODE expression, the corresponding component is not taken into account for the stoichiometric matrix.

input = [model]

model: SBmodel to determine the stoichiometric matrix for.

output = [N,componentNames,reactionNames,reversibleFlag]

N: Stoichiometric matrix
componentNames: Cell-array with the names of the components present in the stoichiometric matrix
reactionNames: Cell-array with the names of the reactions present in the stoichiometric matrix
reversibleFlag: Vector with same number of entries as reactions. An entry of 0 indicates an irreversible reaction, an entry of 1 indicates a reversible reaction. The ordering is the same as the reaction names.

Examples An example SBML model is provided in the SBTOOLBOX2/_EXAMPLES folder. Change into this folder and type:

>> novak_tyson
>> [N,comp,reac,reversFlag] = SBstoichiometry(sbm)

[output] = SBreactantstoichiometry(input)
Usage Determines the reactant stoichiometric matrix for the given model. Non-elementary reactions are taken into account ... otherwise this function would not really make sense. The same limitations regarding the model syntax apply as for the SBstoichiometry function.

input = [model]

model: SBmodel to determine the stoichiometric matrix for.

output = [L]

N: Reactant stoichiometric matrix

Examples

[output] = SBmakeirreversible(input)
Usage For certain analysis methods it is useful that all reaction rate expressions in a model are irreversible. This function takes an SBmodel as input and replaces all reversible reactions by irreversible ones. This is done by splitting up reversible reaction rates into one forward and one backward rate. For this to be possible it is IMPORTANT that the reaction rate expressions that are marked as reversible in the model are defined in the following format:

ReactionRate = RateForward - RateReverse

where ReactionRate can be any reaction rate name, and the terms RateForward and RateReverse can be any mathematical expressions, involving parameters, states, functions, and/or variables. However, it is IMPORTANT that there is only one minus sign in the top level of the formula. Minus signs in eventual parentheses are not taken into account for the parsing and are therefor, of course, allowed to be present. Examples:

R1 = Rf1 - Rr1
R2 = k1*A - k2*B
R3 = (k1-k2*A) - (k3+k4*B)

Additionally it is important that all ODE right hand sides are defined in terms of reaction rate terms, as discussed under the function SBstoichiometry.

input = [model]

model: SBmodel for which to convert reversible reactions to irreversible ones.

output = [modelout]

modelout: Converted model, where all reversible reactions have been exchanged against irreversible ones.

Examples An example SBML model is provided in the SBTOOLBOX2/_EXAMPLES folder. Change into this folder and type:

>> novak_tyson
>> changedmodel = SBmakeirreversible(sbm)
>> SBedit(changedmodel)

In the SBedit window you can see that 4 reversible reactions have been converted to 8 irreversible ones. The ODE expressions are updated accordingly.

Local Parameter Sensitivity Analysis Functions

output = SBsensdataosc(input)
Usage This function allows to generate data that subsequently can be used for different kinds of parametric sensitivity analyses. Used only for oscillating systems! This function should only be used in the case that no events are present in the model.

The data is obtained by simulation of the nominal and perturbed systems. In each simulation of a perturbed system only a single parameter is perturbed. The used integrator for this is 'ode23s'. As initial state for the simulation the initial conditions stored in the model are used. As nominal parameter values the parameter values stored in the model are used.

input = [sbm,timeData]
input = [sbm,timeData,parameters]
input = [sbm,timeData,parameters,pertSize,absRel]
input = [sbm,timeData,parameters,pertSize, absRel, integratorOptions]
input = [sbm,timeData,parameters,pertSize, absRel, integratorOptions, eventFunction]

sbm: SBmodel (not useable with ODE model file)
timeData: this argument can be a scalar, a vector of length 2, or of length 3:

timeData = [timeHorizont]
timeData = [timeHorizont, nrTransientHorizonts]
timeData = [timeHorizont, nrTransientHorizonts, deltaT]

timeHorizont: determines the time over which data is collected for later analysis.
nrTransientHorizonts: before collecting data the systems is simulated over a time nrTransientHorizonts*timeHorizont. A value larger than 0 should be chosen in order to allow transients to die out (default: 2)
deltaT: the simulated data is returned in discrete time-steps of size deltaT (default: timeHorizont/1000)

parameters: a cell-array with parameter names, determining the parameters that are to be considered in the analysis (default: all parameters in model)
pertSize: either a scalar value, determining the perturbation to be applied to each of the parameters, or a vector of same length as the number of considered parameters, allowing to choose a different perturbation for each parameter (default: 1 percent)
absRel: either a scalar (0 or 1), or a vector of the same length as pertSize. 0 means that the corresponding element in pertSize determines an absolute perturbation, 1 means it determines a relative perturbation in percent (default: 1=relative perturbation in percent)
integratorOptions: standard MATLAB integrator options that can be set using the 'odeset' function (default: [])
eventFunction: the user can specify an event function (given by a string with its name) that allows to collect additional data (in terms of time-instants at which certain events occurr) for different kinds of sensitivity analyses. Per default the event function 'periodeventfunctionSB' is used and allows to determine the period of the oscillating system. A custom event function should be realized as an m file and be available in the MATLAB path. If you want to write a custom event function please have a look at the 'periodeventfunctionSB' first.

The only required input arguments are sbm and timeData=[timeHorizont]. If no specified otherwise, default values are used.

The output argument output is a MATLAB struct element with the following structure:

output.model: Model as obtained as input argument
output.time: Simulation time vector
output.tenom: Time-steps for nominal system - time-steps used to determine the period of eventual oscillations in the system
output.tepert: Cell-array, where each entry corresponds to time-steps for a perturbed system - time-steps used to determine the period of eventual oscillations in the system
output.states: Cell-array with statenames as elements (same ordering as for the simulation data)
output.xnom: Matrix containing time instants in rows and state values in columns
output.xpert: Cell-array, where each entry correponds to the simulation result for a single perturbed parameter. The format of the elements is the same as for xnom
output.parameters: Same as the input argument parameters - either its default or the passed values
output.nomvalues: Nominal values of parameters in above field
output.pertSize: Same as the input argument pertSize - either its default or the passed values
output.absRel: Same as the input argument absRel - either its default or the passed values

Examples An example model is provided in the SBTOOLBOX2/_EXAMPLES folder. Change into this folder and type:

>> novak_tyson
>> output = SBsensdataosc(sbm,400)

The last command will generate the dataset that is needed to determine amplitude and period sensitivities. What it is doing should be self explaining from the information printed to the MATLAB window.

output = SBsensdataoscevents(input)
Usage This function has exactly the same syntax as the function SBsensdataosc. The only difference is that it is used for the sensitivity analysis of models in which events are present.
Examples An example model is provided in the SBTOOLBOX2/_EXAMPLES folder. Change into this folder and type:

>> sbm = SBmodel('eventexample2.txt')
>> output = SBsensdataoscevents(sbm,20)

The last command will generate the dataset that is needed to determine amplitude and period sensitivities. What it is doing should be self explaining from the information printed to the MATLAB window.

output = SBsensamplitude(input)
Usage This function determines the local first order amplitude sensitivities (both normalized and non-normalize) with respect to small changes in single parameters. Before invoking this function a dataset needs to be determined using the SBsensdataosc function.

To learn more about the implementation of this analysis please read the help text to this function in MATLAB.

input = [datastructure]

datastructure: This is the structure that is returned from the SBsensdataosc function.

If no output argument is given, the determined data are plotted using the function SBplot2.

The output argument output contains the information about the amplitude sensitivities and has the following structure:

output.S: Matrix, with elements S_ij (please read the help text in MATLAB to learn more)
output.namesS: Cell-array with state names for which the analysis has been done (for the non-normalized sensitivities)
output.parametersS: Cell-array with names of parameters used in analysis (for the non-normalized sensitivities)
output.Sn: Same as output.S, but the sensitivities are normalized
output.namesSn: Cell-array with state names for which the analysis has been done (for the normalized sensitivities)
output.parametersSn: Cell-array with names of parameters used in analysis (for the normalized sensitivities)

The reason for having different fields for parameters and names for the non-normalized and normalized sensitivities is due to the fact that zero nominal parameter values lead to zero normalized sensitivities for these parameters, and that zero nominal steady-state values of states lead to infinite normalized sensitivities. In these cases the normalized sensitivities for these parameters and states are not determined.

The output.plotDataS and output.plotDataSn fields contain datastructures that can directly be used as input arguments for SBplot2 for visualization of the sensitivity analysis results. For information about how this data structure is defined please refer to the help text provided for the SBplot2 function.

Examples Please first execute the example given for the SBsensdataosc function. Then type:

>> SBsensamplitude(output)

Browse around in the appearing graphical user interface (SBplot2) to get an idea what it is doing. Note that the title of the figure is changing according to the chosen plot settings.

output = SBsensperiod(input)
Usage This function determines the local first order period sensitivities (both normalized and non-normalize) with respect to small changes in single parameters. Before invoking this function a dataset needs to be determined using the SBsensdataosc function.

To learn more about the implementation of this analysis please read the help text to this function in MATLAB.

input = [datastructure]

datastructure: This is the structure that is returned from the SBsensdataosc function.

If no output argument is given, the determined data are plotted using the function SBplot2.

The output argument output contains the information about the period sensitivities and has the following structure:

output.S: Matrix, with elements S_ij (please read the help text in MATLAB to learn more)
output.namesS: Cell-array with state names for which the analysis has been done (for the non-normalized sensitivities)
output.parametersS: Cell-array with names of parameters used in analysis (for the non-normalized sensitivities)
output.Sn: Same as output.S, but the sensitivities are normalized
output.namesSn: Cell-array with state names for which the analysis has been done (for the normalized sensitivities)
output.parametersSn: Cell-array with names of parameters used in analysis (for the normalized sensitivities)

The reason for having different fields for parameters and names for the non-normalized and normalized sensitivities is due to the fact that zero nominal parameter values lead to zero normalized sensitivities for these parameters, and that zero nominal steady-state values of states lead to infinite normalized sensitivities. In these cases the normalized sensitivities for these parameters and states are not determined.

The output.plotDataS and output.plotDataSn fields contain datastructures that can directly be used as input arguments for SBplot2 for visualization of the sensitivity analysis results. For information about how this data structure is defined please refer to the help text provided for the SBplot2 function.

Examples Please first execute the example given for the SBsensdataosc function. Then type:

>> SBsensperiod(output)

Browse around in the appearing graphical user interface (SBplot2) to get an idea what it is doing. Note that the title of the figure is changing according to the chosen plot settings.

output = SBsensdatastat(input)
Usage This function allows to to generate steady-state data that subsequently can be used for different kinds of parametric sensitivity analyses.

The data is obtained by determining the steady-states of the nominal and perturbed systems. In each calculation of a perturbed system only a single parameter is perturbed. As initial guess for the steady-state the initial conditions stored in the model are used. As nominal parameter values the parameter values stored in the model are used. In case the considered steady-state is unstable at least a good guess of the steady-state needs to be given in the model.

input = [sbm]
input = [sbm,parameters]
input = [sbm,parameters,pertSize,absRel]
input = [sbm,parameters,pertSize,absRel,OPTIONS]

sbm: SBmodel (not useable with ODE model file)
parameters: a cell-array with parameter names, determining the parameters that are to be considered in the analysis (default: all parameters in model)
pertSize: either a scalar value, determining the perturbation to be applied to each of the parameters, or a vector of same length as the number of considered parameters, allowing to choose a different perturbation for each parameter (default: 1 percent)
absRel: either a scalar (0 or 1), or a vector of the same length as pertSize. 0 means that the corresponding element in pertSize determines an absolute perturbation, 1 means it determines a relative perturbation in percent (default: 1=relative perturbation in percent)
OPTIONS: OPTIONS: this is a data structure defining the options for the SBsteadystate function that is used here.
OPTIONS.TolFun: Tolerance for max element in function evaluation (default: see SBsteadystate).
OPTIONS.tol: Tolerance for the determination of the number of algebraic relationships in the model. If the method fails than this might be due to a wrong rank computation and in this case the tolerance should be increased. If set, the same tolerance setting is used when determining the indices of the dependent variables (default: see SBsteadystate).
OPTIONS.MaxIter: Maximum number of iterations (default: see SBsteadystate).
OPTIONS.Delta: Step length for numerical differentiation to obtain the Jacobian (default: see SBsteadystate).

The output argument output is a MATLAB struct element with the following structure:

output.model: Model as obtained as input argument
output.states: Cell-array with names of states as elements
output.xssnom: Vector containing the steady-state values of the states of the nominal system
output.xsspert: Cell-array, where each entry correponds to a vector containing the steady-state of the states of the perturbed systems
output.reactions: Cell-array with names of reactions as elements
output.rssnom: Vector containing the steady-state values of the reaction rates of the nominal system
output.rsspert: Cell-array, where each entry correponds to a vector containing the steady-state of the reaction rates of the perturbed systems
output.parameters: Same as the input argument parameters - either its default or the passed values
output.nomvalues: Nominal values of parameters in above field
output.pertSize: Same as the input argument pertSize - either its default or the passed values
output.absRel: Same as the input argument absRel - either its default or the passed values

Examples An example model is provided in the SBTOOLBOX2/_EXAMPLES folder. Change into this folder and type:

>> novak_tyson
>> output = SBsensdatastat(sbm)

The last command will generate the dataset that is needed to determine steady-state sensitivities. What it is doing should be self explaining from the information printed to the MATLAB window.

output = SBsensstat(input)
Usage This function determines the local first order steady-state sensitivities (both normalized and non-normalize) with respect to small changes in single parameters. Before invoking this function a dataset needs to be determined using the SBsensdatastat function.

To learn more about the implementation of this analysis please read the help text to this function in MATLAB.

input = [datastructure]

datastructure: This is the structure that is returned from the SBsensdatastat function.

If no output argument is given, the determined data are plotted using the function SBplot2.

The output argument output contains the information about the steady-state sensitivities and has the following structure:

output.S: Matrix, with elements S_ij (please read the help text in MATLAB to learn more)
output.namesS: Cell-array with state names for which the analysis has been done (for the non-normalized sensitivities)
output.parametersS: Cell-array with names of parameters used in analysis (for the non-normalized sensitivities)
output.Sn: Same as output.S, but the sensitivities are normalized
output.namesSn: Cell-array with state names for which the analysis has been done (for the normalized sensitivities)
output.parametersSn: Cell-array with names of parameters used in analysis (for the normalized sensitivities)

The reason for having different fields for parameters and names for the non-normalized and normalized sensitivities is due to the fact that zero nominal parameter values lead to zero normalized sensitivities for these parameters, and that zero nominal steady-state values of states lead to infinite normalized sensitivities. In these cases the normalized sensitivities for these parameters and states are not determined.

The output.plotDataS and output.plotDataSn fields contain datastructures that can directly be used as input arguments for SBplot2 for visualization of the sensitivity analysis results. For information about how this data structure is defined please refer to the help text provided for the SBplot2 function.

Examples Please first execute the example given for the SBsensdatastat function. Then type:

>> SBsensstat(output)

Browse around in the appearing graphical user interface (SBplot2) to get an idea what it is doing. Note that the title of the figure is changing according to the chosen plot settings.

output = SBmca(input)
Usage This function uses the steady state sensitivity analysis functions of the SBtoolbox2 to determine flux control coefficients and concentration control coefficients. Additionally it computes elasticity coefficients. It is important to note that all states in the analyzed SBmodel are assumed to represent concentrations of substrates and all reactions enzymatic reactions. If this is not the case for certain states and/or reactions the user needs to postprocess the results by deleting the corresponding columns and rows in the matrices FCC, CCC, EC. Furthermore, the model should only contain irreversible reactions (consider the use of SBmakeirreversible).

input = [model]
input = [model, OPTIONS]

model: SBmodel
OPTIONS: structure containing options for the function:
OPTIONS.pertsize: size of the perturbation that is used to determine the sensitivities. Scalar value => same perturbation for all perturbed parameters. (default: 1)
OPTIONS.absRel: scalar value 1 or 0. =1: The perturbation chosen in the previous option is interpreted as a relative perturbation and assumed to be given in percent. =0: The perturbation in the previous option is interpreted as an absolute perturbation. (default: 1)

If no output argument is given, the determined MCA data (FCC, CCC, EC) are plotted using the function SBplot2.

Otherwise, the output argument 'output' is a MATLAB struct element with the following structure:
output.states: Cell-array with the names of the states (substrates).
output.reactions: Cell-array with the name of the reaction/enzyme names.
output.FCC: Matrix containing the Flux Control Coefficients (One row per flux and one column per enzyme).
output.CCC: Matrix containing the Concentration Control Coefficients (One row per substrate and one column per enzyme).
output.EC: Matrix containing the Elasticity Coefficients (One row per enzyme and one column per substrate).

Examples Should be self explaining.

Global Parameter Sensitivity Analysis Functions

output = SBsensglobalfast(input)
Usage
Global sensitivity analysis method: Extended FAST method
 
For more information see:
 
Y. Zheng and A. Rundell (2006) Comparative study of parameter 
sensitivity analyses of the TCR-activated Erk-MAPK signalling 
pathway, IEE Proc.-Syst. Biol., Vol. 153, No. 4, 201-211
 
Saltelli, A., Tarantola, S., and Chan, K.P.S. (1999) A quantitative
model-independent method for global sensitivity analysis of model
output, Technometrics, 41, 39–56
 
USAGE:
======
SBsensglobalfast(model,timevector)
SBsensglobalfast(model,timevector,paramNames)
SBsensglobalfast(model,timevector,paramNames,OPTIONS)
[output] = SBsensglobalfast(model,timevector)
[output] = SBsensglobalfast(model,timevector,paramNames)
[output] = SBsensglobalfast(model,timevector,paramNames,OPTIONS)
 
model: SBmodel to perform the global sensitivity analysis for
timevector: vector of timeinstants to consider
paramNames: cell-array with names of the parameters to consider
OPTIONS: structure with optional settings:
  OPTIONS.statenames: cell-array with state names which to consider
      as model outputs
  OPTIONS.variablenames: cell-array with variable names which to 
      consider as model outputs
  OPTIONS.reactionnames: cell-array with reaction names which to 
      consider as model outputs
  OPTIONS.Nsim: Number of simulation to carry out (approximate 
      value)
  OPTIONS.range: Order of magnitude of parameter perturbations
  OPTIONS.firstorder: =0: use total effect, =1: use firstorder appr.
  OPTIONS.objectivefunction: ='relative': the differences between 
      nominal and perturbed model are normalized to represent 
      relative changes in each considered variable. ='absolute': 
      no normalization is done. Alternatively, the user can provide 
      the name for an own objective function to use. As template 
      you can have a look at the two objectivefunctions in the 
      folder:
      SBTOOLBOX2/analysis/globalparametersensitivity/auxiliary
  OPTIONS.integrator: Structure with optional settings for the 
      integrator

DEFAULT VALUES:
===============
paramNames: Consider all parameters in the model
OPTIONS.statenames: Consider all states in the model
OPTIONS.variablenames: {} (no variables)
OPTIONS.reactionnames: {} (no reactions)
OPTIONS.Nsim: 1000
OPTIONS.range: 1
OPTIONS.firstorder: 0 (use total effect)
OPTIONS.objectivefunction: 'relative'
OPTIONS.integrator: [] (default integrator settings)

Output Arguments:
=================
If no output argument is specified, the result is plotted.
Otherwise, the output is a structure with the following fields:

output.Nsim: Number of performed simulations
output.method: Name of the global sensitivity method
output.parameters: Considered parameters 
output.overallmeasure: Sensitivity indices for overall model output
output.overallparamranking: Parameter ranking regarding overall 
      model output
output.singlecomponents: Names of the components, considered outputs
output.singlemeasure: Single sensitivity indices for all considered 
      model outputs
output.singleparamranking: Parameter ranking for each considered 
      model output
Examples

output = SBsensglobalprcc(input)
Usage
Global sensitivity analysis method: PRCC method
 
For more information see:
 
Y. Zheng and A. Rundell (2006) Comparative study of parameter 
sensitivity analyses of the TCR-activated Erk-MAPK signalling 
pathway, IEE Proc.-Syst. Biol., Vol. 153, No. 4, 201-211
 
Draper, N., and Smith, H. (1981) Applied regression analysis, 
Wiley, New York, 2nd edn.
 
USAGE:
======
SBsensglobalprcc(model,timevector)
SBsensglobalprcc(model,timevector,paramNames)
SBsensglobalprcc(model,timevector,paramNames,OPTIONS)
[output] = SBsensglobalprcc(model,timevector)
[output] = SBsensglobalprcc(model,timevector,paramNames)
[output] = SBsensglobalprcc(model,timevector,paramNames,OPTIONS)
   
model: SBmodel to perform the global sensitivity analysis for
timevector: vector of timeinstants to consider
paramNames: cell-array with names of the parameters to consider
OPTIONS: structure with optional settings:
  OPTIONS.statenames: cell-array with state names which to consider
      as model outputs
  OPTIONS.variablenames: cell-array with variable names which to 
      consider as model outputs
  OPTIONS.reactionnames: cell-array with reaction names which to 
      consider as model outputs
  OPTIONS.Nsim: Number of simulation to carry out (approximate 
      value)
  OPTIONS.range: Order of magnitude of parameter perturbations
  OPTIONS.objectivefunction: ='relative': the differences between 
      nominal and perturbed model are normalized to represent 
      relative changes in each considered variable. ='absolute': 
      no normalization is done. Alternatively, the user can provide 
      the name for an own objective function to use. As template 
      you can have a look at the two objectivefunctions in the 
      folder:
      SBTOOLBOX2/analysis/globalparametersensitivity/auxiliary
  OPTIONS.integrator: Structure with optional settings for the 
      integrator

DEFAULT VALUES:
===============
paramNames: Consider all parameters in the model
OPTIONS.statenames: Consider all states in the model
OPTIONS.variablenames: {} (no variables)
OPTIONS.reactionnames: {} (no reactions)
OPTIONS.Nsim: 1000
OPTIONS.range: 1
OPTIONS.objectivefunction: 'relative'
OPTIONS.integrator: [] (default integrator settings)

Output Arguments:
=================
If no output argument is specified, the result is plotted.
Otherwise, the output is a structure with the following fields:

output.Nsim: Number of performed simulations
output.method: Name of the global sensitivity method
output.parameters: Considered parameters 
output.overallmeasure: Sensitivity indices for overall model output
output.overallparamranking: Parameter ranking regarding overall 
      model output
output.singlecomponents: Names of the components, considered outputs
output.singlemeasure: Single sensitivity indices for all considered 
      model outputs
output.singleparamranking: Parameter ranking for each considered 
      model output
Examples

output = SBsensglobalsobol(input)
Usage
Global sensitivity analysis method: SOBOL's method
 
For more information see:
 
Y. Zheng and A. Rundell (2006) Comparative study of parameter 
sensitivity analyses of the TCR-activated Erk-MAPK signalling 
pathway, IEE Proc.-Syst. Biol., Vol. 153, No. 4, 201-211
 
Sobol, I.M. (2001) Global sensitivity indices for nonlinear 
mathematical models and their Monte Carlo estimates, 
Math. Comp. Simul., 55, 271–280
 
USAGE:
======
SBsensglobalsobol(model,timevector)
SBsensglobalsobol(model,timevector,paramNames)
SBsensglobalsobol(model,timevector,paramNames,OPTIONS)
[output] = SBsensglobalsobol(model,timevector)
[output] = SBsensglobalsobol(model,timevector,paramNames)
[output] = SBsensglobalsobol(model,timevector,paramNames,OPTIONS)
 
model: SBmodel to perform the global sensitivity analysis for
timevector: vector of timeinstants to consider
paramNames: cell-array with names of the parameters to consider
OPTIONS: structure with optional settings:
  OPTIONS.statenames: cell-array with state names which to consider
      as model outputs
  OPTIONS.variablenames: cell-array with variable names which to 
      consider as model outputs
  OPTIONS.reactionnames: cell-array with reaction names which to 
      consider as model outputs
  OPTIONS.Nsim: Number of simulation to carry out (approximate 
      value)
  OPTIONS.range: Order of magnitude of parameter perturbations
  OPTIONS.firstorder: =0: use total effect, =1: use firstorder appr.
  OPTIONS.objectivefunction: ='relative': the differences between 
      nominal and perturbed model are normalized to represent 
      relative changes in each considered variable. ='absolute': 
      no normalization is done. Alternatively, the user can provide 
      the name for an own objective function to use. As template 
      you can have a look at the two objectivefunctions in the 
      folder:
      SBTOOLBOX2/analysis/globalparametersensitivity/auxiliary
  OPTIONS.integrator: Structure with optional settings for the 
      integrator

DEFAULT VALUES:
===============
paramNames: Consider all parameters in the model
OPTIONS.statenames: Consider all states in the model
OPTIONS.variablenames: {} (no variables)
OPTIONS.reactionnames: {} (no reactions)
OPTIONS.Nsim: 1000
OPTIONS.range: 1
OPTIONS.firstorder: 0 (use total effect)
OPTIONS.objectivefunction: 'relative'
OPTIONS.integrator: [] (default integrator settings)

Output Arguments:
=================
If no output argument is specified, the result is plotted.
Otherwise, the output is a structure with the following fields:

output.Nsim: Number of performed simulations
output.method: Name of the global sensitivity method
output.parameters: Considered parameters 
output.overallmeasure: Sensitivity indices for overall model output
output.overallparamranking: Parameter ranking regarding overall 
      model output
output.singlecomponents: Names of the components, considered outputs
output.singlemeasure: Single sensitivity indices for all considered 
      model outputs
output.singleparamranking: Parameter ranking for each considered 
      model output
Examples

output = SBsensglobalwals(input)
Usage
Global sensitivity analysis method: WALS (weighted average of local
sensitivities)
 
For more information see:
 
Y. Zheng and A. Rundell (2006) Comparative study of parameter 
sensitivity analyses of the TCR-activated Erk-MAPK signalling 
pathway, IEE Proc.-Syst. Biol., Vol. 153, No. 4, 201-211
 
Bentele, M., Lavrik, I., Ulrich, M., Stößer, S., Heermann, D.W.,
Kalthoff, H., Krammer, P.H., and Eils, R. (2004) Mathematical 
modeling reveals threshold mechanism in CD95-induced apoptosis, 
J. Cell Biol., 166, (6), pp. 839–851 

USAGE:
======
SBsensglobalwals(model,timevector)
SBsensglobalwals(model,timevector,paramNames)
SBsensglobalwals(model,timevector,paramNames,OPTIONS)
[output] = SBsensglobalwals(model,timevector)
[output] = SBsensglobalwals(model,timevector,paramNames)
[output] = SBsensglobalwals(model,timevector,paramNames,OPTIONS)
 
model: SBmodel to perform the global sensitivity analysis for
timevector: vector of timeinstants to consider
paramNames: cell-array with names of the parameters to consider
OPTIONS: structure with optional settings:
  OPTIONS.statenames: cell-array with state names which to consider
      as model outputs
  OPTIONS.variablenames: cell-array with variable names which to 
      consider as model outputs
  OPTIONS.reactionnames: cell-array with reaction names which to 
      consider as model outputs
  OPTIONS.Nsim: Number of simulation to carry out (approximate 
      value)
  OPTIONS.range: Order of magnitude of parameter perturbations
  OPTIONS.deltaPert: relative perturbation for determining local
      sensitivities. If a parameters nominal value is zero a 
      warning will appear.
  OPTIONS.objectivefunction: ='relative': the differences between 
      nominal and perturbed model are normalized to represent 
      relative changes in each considered variable. ='absolute': 
      no normalization is done. Alternatively, the user can provide 
      the name for an own objective function to use. As template 
      you can have a look at the two objectivefunctions in the 
      folder:
      SBTOOLBOX2/analysis/globalparametersensitivity/auxiliary
  OPTIONS.integrator: Structure with optional settings for the 
      integrator

DEFAULT VALUES:
===============
paramNames: Consider all parameters in the model
OPTIONS.statenames: Consider all states in the model
OPTIONS.variablenames: {} (no variables)
OPTIONS.reactionnames: {} (no reactions)
OPTIONS.Nsim: 1000
OPTIONS.range: 1
OPTIONS.deltaPert: 0.02 (2 percent)
OPTIONS.objectivefunction: 'relative'
OPTIONS.integrator: [] (default integrator settings)

Output Arguments:
=================
If no output argument is specified, the result is plotted.
Otherwise, the output is a structure with the following fields:

output.Nsim: Number of performed simulations
output.method: Name of the global sensitivity method
output.parameters: Considered parameters 
output.overallmeasure: Sensitivity indices for overall model output
output.overallparamranking: Parameter ranking regarding overall 
      model output
output.singlecomponents: Names of the components, considered outputs
output.singlemeasure: Single sensitivity indices for all considered 
      model outputs
output.singleparamranking: Parameter ranking for each considered 
      model output
Examples

Localization of Mechanisms leading to Complex Behaviors

[output] = SBlocbehavcomp(input)
Usage Determines the importance of components in the given biochemical system in the creation of an observed complex behavior, such as multiple steady-states and sustained oscillations.

Central functions in the cell are often linked to complex dynamic behaviors, such as sustained oscillations and multistability, in a biochemical reaction network. Determination of the specific mechanisms underlying such behaviors is important, e.g., to determine sensitivity, robustness, and modelling requirements of given cell functions.

The aim of the "SBlocbehavcomp" function is to identify the components in a biochemical reaction network, described by a set of ordinary differential equations, that are mainly involved in creating an observed complex dynamic behavior, such as sustained oscillations or multiple steady-states.

Rather than analyzing the biochemical system in a state corresponding to the complex nonlinear behavior, the system is considered at its underlying unstable steady-state. This is motivated by the fact that all complex behaviors in unforced systems can be traced to destabilization (bifurcation) of some steady-state, and hence enables the use of tools from Linear System Theory to qualitatively analyze the sources of given network behaviors.

A full description of this method can be found in "Linear systems approach to analysis of complex dynamic behaviours in biochemical networks", IEE Systems Biology, 1, 149-158 (2004) and "Identifying feedback mechanisms behind complex cell behavior", IEEE Control Systems Magazine, 24 (4), 91-102 (2004)

input = [model, steadystate]
input = [model, steadystate, OPTIONS]

model: SBmodel or ODE file to perform the analysis on.
steadystate: Steady-state at which to perform the analysis.
OPTIONS: The options argument is structure with the following fields: OPTIONS.orderDataFlag: =0: non ordered data, =1: ordered data after importance (only used for plotting purpose) (default: 0).
OPTIONS.plotTypeFlag: =0: linear y-axis, =1: logarithmic y-axis (default: 0).
OPTIONS.minEpsilonValue, OPTIONS.maxEspilonValue: Definition of the range of values for checking the epsilons (default: 0.0001, 1000).
[-maxEspilonValue ... -minEpsilonValue ... minEpsilonValue ... maxEpsilonValue] OPTIONS.nrPoints: number of points in the range above (default: 5000).

If no output arguments are given, the result of the analysis is plotted. The importances are color-coded. Blue color is used for positive importances, red color for negative importances that are smaller than -1, and black color for negative importances that are between 0 and -1. Since the determined epsilon perturbations are relative perturbations and therefor values for epsilon < -1 (0 > importances > -1) lead to a change of sign in the corresponding feedback loop, the two different colors for negative importances are used to distinguish these two cases.

output = [importance, stateNames]

importance and stateNames: To the i-th component (state) name corresponds the i-th importance value, defined by importance_i = 1/epsilon_i, where epsilon_i is the relative change in the feedback interconnection in the i-th state (stateNames{i}) that stabilizes the considered unstable steady-state. The smaller the absolute value of the required perturbation, this means, the larger importance_i, the more important role plays state i in the creation of the observed complex behavior. In case the stabilizing value of epsilon_i has a magnitude larger than maxEpsilonValue, zero is returned for the corresponding importance.

Examples An example model is provided in the SBTOOLBOX2/_EXAMPLES folder. Change into this folder and type:

>> novak_tyson
>> SBlocbehavcomp(sbm,SBsteadystate(sbm))

[output] = SBlocbehavinteract(input)
Usage Determines the importance of direct interactions (e.g., reactions) between components in the given biochemical system in the creation of an observed complex behavior, such as multiple steady-states and sustained oscillations. Read below to get more insight into the method.

Central functions in the cell are often linked to complex dynamic behaviors, such as sustained oscillations and multistability, in a biochemical reaction network. Determination of the specific mechanisms underlying such behaviors is important, e.g., to determine sensitivity, robustness, and modelling requirements of given cell functions.

The aim of the "SBlocbehavinteract" function is to identify the mechanism in a biochemical reaction network, described by a set of ordinary differential equations, that are mainly involved in creating an observed complex dynamic behavior, such as sustained oscillations or multiple steady-states.

Rather than analyzing the biochemical system in a state corresponding to the complex nonlinear behavior, the system is considered at its underlying unstable steady-state. This is motivated by the fact that all complex behaviors in unforced systems can be traced to destabilization (bifurcation) of some steady-state, and hence enables the use of tools from Linear System Theory to qualitatively analyze the sources of given network behaviors.

A full description of this method can be found in "Linear systems approach to analysis of complex dynamic behaviours in biochemical networks", IEE Systems Biology, 1, 149-158 (2004) and "Identifying feedback mechanisms behind complex cell behavior", IEEE Control Systems Magazine, 24 (4), 91-102 (2004)

input = [model, steadystate]
input = [model, steadystate, OPTIONS]

model: SBmodel or ODE file to perform the analysis on.
steadystate: Steady-state at which to perform the analysis.
OPTIONS: The OPTIONS argument is a structure with the following fields:

OPTIONS.plotTypeFlag: =0: linear y-axis, =1: logarithmic y-axis (default: 0).
OPTIONS.visualizeFlag: =0: nothing, =1: setting this flag to 1 allows to monitor the continuation of the critical locus and to see if the values for criticalLocusTolerance and criticalLocusNrPoints are set acceptably (default: 0).
OPTIONS.omegaRange: to determine the critical frequency omega0 the function searches in a range from omega_star/omegaRange ... omega_star*omegaRange, where omega_star is the positive imaginary part of the unstable pole in the linearized system (default: 10).
OPTIONS.omegaRangePoints: the above range is discretized in so many steps, allowing to find a lower and upper bound for omega0 (default: 50).
OPTIONS.bisectionThreshold: omega0 is then determined by bisection until the bounds have a distance less than this option value (default: 1e-14).
OPTIONS.criticalLocusTolerance: each determined perturbation Delta_ij is checked if it is stabilizing. This is done by continuation. If the final value of the critical locus is less than this option away from +1 it is a stabilizing perturbation (default: 1e-5).
OPTIONS.criticalLocusNrPoints: the number of points used for the continuation of the critical locus (larger=>slower, more exact, smaller => faster, eventually problems) (default: 10).

If no output arguments are given, the results of the analysis are plotted. The result is color coded. Blue color corresponds to positive elements of the corresponding nominal Jacobian, red color corresponds to negative elements.

output = [importance, stateNames]

importance: each row corresponds to a direct interaction between states in the considered system. The first element in a row determines the index of the affected and the second the index of the affecting state. The third element in a row determines the inverse of the magnitude of the corresponding delta_ij value. delta_ij is the value for the relative perturbation in the direct interaction from state j to state i that stabilizes the considered steady-state. The larger this inverse is, the more important is the direct effect from state j on state i for the creation of the analyzed behavior.
stateNames: the name of the states corresponding to the numbering of columns and rows.

Examples An example model is provided in the SBTOOLBOX2/_EXAMPLES folder. Change into this folder and type:

>> novak_tyson
>> SBlocbehavinteract(sbm,SBsteadystate(sbm))

The smaller the magnitudes of the stabilizing perturbations for a certain interaction, the more important this interaction is in the creation of the oscillations observed in the model around the considered steady-state. In this example it is actually the interactions between components 5, 8, and 9 that create the oscillative behavior. This is well reflected by the analysis result.

[output] = SBlocbehavinteract2(input)
Usage This function does basically the same as the SBlocbehavinteract function, except that it can be used in the case where the open loop system is unstable. This function does not check if the determined perturbations actually stabilize the system at the considered steady-state, but still gives a good insight into the importance of interactions in creating an observed complex behavior.

For more information please read the information about the SBlocbehavinteract function, and the help text for this function by typing >> help SBlocbehavinteract2

Examples An example model is provided in the SBTOOLBOX2/_EXAMPLES folder. Change into this folder and type:

>> novak_tyson
>> SBlocbehavinteract2(sbm,SBsteadystate(sbm))

Compare the result to the result obtained when using the SBlocbehavinteract function. Using the SBlocbehavinteract less interactions are plotted/returned as result, since only these are stabilizing the system. Furthermore the numerical values of the determined perturbations are slightly different. This is because using SBlocbehavinteract the analysis is done at the frequency where the critical eigenlocus crosses the real axis, while using SBlocbehavinteract2 the analysis is done at the frequency given by the imaginary part of the unstable eigenvalue.

Model Reduction Functions (Require the Symbolic Toolbox)

output = SBredallreac(input)
Usage Wrapper for the SBredreac function allowing to easily go through a whole model and reduce the kinetic rate expressions of all reactions that are possible to reduce. This function also compares the reduced with the original model after each accepted reduction step. The user can freely modify the way how the models are compared, by customising the comparison routine in this function.

input = [sbm,time,experiments]
input = [sbm,time,experiments,extravariables]
input = [sbm,time,experiments,extravariables,OPTIONS]

sbm: SBmodel to reduce
timevectors: Cell-array with timevectors for the reference data generation (one for each experiment).
experiments: Cell-array where each element corresponds to the description of an experiment (SBexperiment object).
extravariables: Cell-array with names of parameters that should be taken into account as species belonging to the M vector or parameters that are set to different values during experiments (then they need to be kept in the reduced model) (default: {}).
OPTIONS: Structure with possible options:
OPTIONS.tol: Tolerance for singularity detection (smallest SV) (default: 1e-6)
OPTIONS.keeporigparameters: =0: do not keep original parameters, =2: do always keep original parameters, =1: keep original parameters only if it leads to fewer parameters (default: 0)
OPTIONS.numeratorweighting: =1: weight numerator terms and denumerator terms such that numerators are kept, =0: dont do any weighting (default: 0)

output = [sbmreduced]

sbmreduced: Reduced SBmodel.

Examples This function requires the presence of the SBPD package. An example script reduceExample.m can be found in the SBPD/_EXAMPLES/ModredExample folder.

output = SBprepredreac(input)
Usage Prepares a model for subsequent reduction of reaction rate expressions. Eventual "power(x,y)" expressions are exchanged against "x^y". Reaction rates are expanded by substituting in variables. Ununsed elements (reactions, variables, and parameters) are deleted from the model. Furthermore reference simulations are performed based on which the models reactions can be reduced in following steps.

input = [sbm, time, experiments]
input = [sbm, time, experiments, extravariables]

sbm: SBmodel to reduce
time: Timevector for the reference data generation
experiments: Cell-array where each element corresponds to the description of an experiment (SBexperiment object).
extravariables: Cell-array with names of parameters that should be taken into account as species.

output = [output]

output: Structure with necessary information that is used as input for the SBredreac function.

Examples This function requires the presence of the SBPD package. An example script reduceExample.m can be found in the SBPD/_EXAMPLES/ModredExample folder.

output = SBredreac(input)
Usage Reduction of single reaction expressions with the goal of reducing complexity and number of parameters. This function requires the prior execution of the SBprepredreac.

input = [prepoutput, reaction]
input = [prepoutput, reaction, OPTIONS]

prepoutput: Result returned from SBprepredreac.
reaction: Name of the reaction that should be reduced.
OPTIONS: Structure with possible options:
OPTIONS.tol: Tolerance for singularity detection (smallest SV) (default: 1e-6)
OPTIONS.keeporigparameters: =0: do not keep original parameters, =2: do always keep original parameters, =1: keep original parameters only if it leads to fewer parameters (default: 0)
OPTIONS.numeratorweighting: =1: weight numerator terms and denumerator terms such that numerators are kept, =0: dont do any weighting (default: 0)

output = [sbmreduced]

sbmreduced: Reduced SBmodel.

Examples This function requires the presence of the SBPD package. An example script reduceExample.m can be found in the SBPD/_EXAMPLES/ModredExample folder.

Optimization

output = simplexSB(input)
Usage Downhill Simplex Method in Multidimensions. Algorithm based on section 10.4 in "Numerical Recipes in C", ISBN 0-521-43108-5. The algorithm has been modified in order to be able to take into account simple box constraints on parameter values.

input=[FUN,X]
input=[FUN,X,OPTIONS]

FUN: Function to minimize
X: Starting guess for parameter vector
OPTIONS: Structure containing options for the algorithm:
OPTIONS.maxfuneval: Maximum number of function evaluations (default: 200*numberVariables)
OPTIONS.maxiter: Maximum number of iterations (default: 200*numberVariables)
OPTIONS.maxtime: Maximum time (in minutes) for optimization (default: 120)
OPTIONS.tolfun: Tolerance for difference between best and worst function evaluation in simplex (default: 1e-10)
OPTIONS.tolx: Tolerance for max difference between the coordinates of the vertices (default: 1e-10)
OPTIONS.lowbounds: vector containing upper bounds for parameters Instead of a vector highbounds can also be a scalar > 1. In the latter case the highbounds are determined by multiplying this scalar to the initial parameter guess X. This latter case works only for positive X(i) ... if negative present then the user needs to specify a whole lowbounds vector. (default: 0.1)
OPTIONS.higbounds: vector containing lower bounds for parameters. Instead of a vector lowbounds can also be a scalar < 1. In the latter case the lowbounds are determined by multiplying this scalar to the initial parameter guess X. This latter case works only for positive X(i) ... if negative present then the user needs to specify a whole highbounds vector. (default: 10)
OPTIONS.outputFunction: string with output function name. If not given or if empty then no output function will be used. This output function can be used to display data, or to save optimization information to a file. The function needs to be in the MATLAB path. Its calling syntax is:
'outputFunction'(bestparameters,bestfunctionvalue,currentsimplex)
bestparameters: the currently best set of parameters
bestfunctionvalue: the currently minimal cost function value
currentsimplex: the edges of the current simplex

output = [X,FVAL,EXITFLAG]

X: Found solution
FVAL: Value of the function FUN at X
EXITFLAG: 1=success, 0=not found

Examples

output = simannealingSB(input)
Usage Minimization by simulated annealing. Algorithm partly based on section 10.4 in "Numerical Recipes in C", ISBN 0-521-43108-5. The implementation of this simmulated annealing method uses a nonlinear simplex search as basis. The algorithm has been modified in order to be able to take into account simple box constraints on parameter values.

input=[FUN,X]
input=[FUN,X,OPTIONS]

FUN: Function to minimize
X: Starting guess for parameter vector
OPTIONS: Structure containing options for the algorithm:
OPTIONS.tempstart: Starting temperature (should be around the order of magnitude (or higher) than the cost function at the initial guess) (default: 10*magnitude of function value at initial guess)
OPTIONS.tempend: Ending temperature (When performed all iterations for this temperature, the temperature is set to 0 and the simannealingSB function converges to a normal simplex search) (default: 0.1)
OPTIONS.tempfactor: Reduction factor for temperature after running through all iterations for current temperature (default: chosen such that 10 reductions of temperature)
OPTIONS.maxitertemp: Number of iterations to carry put for each non-zero temperature (default: 50*numberVariables)
OPTIONS.maxitertemp0: Number of iterations to carry out for 0 temperature (default: 200*numberVariables)
OPTIONS.maxtime: Maximum time (in minutes) for optimization (default: 120)
OPTIONS.tolfun: Tolerance for difference between best and worst function evaluation in simplex (default: 1e-10)
OPTIONS.tolx: Tolerance for max difference between the coordinates of the vertices (default: 1e-10)
OPTIONS.lowbounds: vector containing upper bounds for parameters Instead of a vector highbounds can also be a scalar > 1. In the latter case the highbounds are determined by multiplying this scalar to the initial parameter guess X. This latter case works only for positive X(i) ... if negative present then the user needs to specify a whole lowbounds vector. (default: 0.1)
OPTIONS.higbounds: vector containing lower bounds for parameters. Instead of a vector lowbounds can also be a scalar < 1. In the latter case the lowbounds are determined by multiplying this scalar to the initial parameter guess X. This latter case works only for positive X(i) ... if negative present then the user needs to specify a whole highbounds vector. (default: 10)
OPTIONS.outputFunction: string with output function name. If not given or if empty then no output function will be used. This output function can be used to display data, or to save optimization information to a file. The function needs to be in the MATLAB path. Its calling syntax is:
'outputFunction'(bestparameters,bestfunctionvalue,currentsimplex)
bestparameters: the currently best set of parameters
bestfunctionvalue: the currently minimal cost function value
currentsimplex: the edges of the current simplex

output = [X,FVAL,EXITFLAG]

X: Found solution
FVAL: Value of the function FUN at X
EXITFLAG: 1=success, 0=not found

Examples

output = isresSB(input)
Usage Stochastic Ranking for Constrained Evolutionary Minimization.

The algorithm is described in:
Thomas Philip Runarsson and Xin Yao, Search Biases in Constrained
Evolutionary Optimization. IEEE Transactions on Systems, Man and
Cybernetics -- Part C: Applications and Reviews. Vol. 35, No. 2,
pp 233-243, May 2005.

The code of this function is based on the original code written by
Thomas Philip Runarsson (e-mail: tpr@verk.hi.is)

input=[FUN,X]
input=[FUN,X,OPTIONS]

FUN: Function to minimize
The cost function is required to have the following calling syntax:
[output] = FUN(x)
The 'output' can be a scalar defining the 'cost', or the 'output' can be a cell array with two elements: {'cost', 'constraints'}. The 'cost' output argument has a scalar value indicating the 'cost' of a given set of parameter values x. The algorithm is able to handle inequality constraints, where feasible parameter sets are defined by negative values of the corresponding constraint functions. The 'constraints' output argument is a vector, where each entry corresponds to one constraint. If the value of an element is positive the corresponding contraint is active. Simple min/max bounds on parameters need not be specified using constraint functions but are taken care of by the isresSB algorithm.
X: Starting Guess for parameter vector
OPTIONS: Structure containing options for the algorithm:
OPTIONS.lowbounds: vector containing lower bounds for parameters. Instead of a vector lowbounds can also be a scalar < 1. In the latter case the lowbounds are determined by multiplying this scalar to the initial parameter guess X (default: 0.1 => lowbounds = 0.1*X).
OPTIONS.highbounds: vector containing upper bounds for parameters Instead of a vector highbounds can also be a scalar > 1. In the latter case the highbounds are determined by multiplying this scalar to the initial parameter guess X (default: 10 => highbounds = 10*X).
OPTIONS.linlog: string, either 'linear' or 'log'. 'linear' means that the parameters are optimized based on their real values, while 'log' means that the parameters are optimized based on their exponent to the base 10. Choose 'linear' for tight min max bounds, and choose 'log' for very wide bounds. The parameter bounds are always given as "real values" and not as exponents! (default: 'linear')
OPTIONS.lambda: scalar, integer, population size (number of offspring) (100 to 400) (default: 200)
OPTIONS.maxgen: maximum number of generations (default: ndim*200)
OPTIONS.maxtime: Maximum time (in minutes) for optimization (default: inf)
OPTIONS.mu: parent number (mu/lambda usually 1/7) (default: lambda/7)
OPTIONS.pf: pressure on fitness in [0 0.5] try around 0.45 (default: 0.45)
OPTIONS.varphi: expected rate of convergence (usually 1) (default: 1)
OPTIONS.outputFunction: string with output function name (default: ''). If not given or if empty then no output function will be used. This output function can be used to display data, or to save optimization information to a file. The function needs to be in the MATLAB path. Its calling syntax is:
'outputFunction'(g,BestParameters,BestMin,Min,Mean,Std,NrFeas,Time)
g: current generation number
BestParameters: the currently best set of parameters
BestMin: the currently minimal cost function value
Min: min costfunction value in current generation (only feasible parameter sets count)
Mean: mean costfunction value in current generation (only feasible parameter sets count)
Std: standard deviation of cost function in current generation (only feasible parameter sets count)
NrFeas: number of feasible parameter sets in current generation
Time: elapsed time

output = [X,FVAL,EXITFLAG]

X: Best feasible individual ([] if EXITFLAG = 0)
FVAL: Value of the function FUN at X ([] if EXITFLAG = 0)
EXITFLAG: =1 if solution is feasible, =0 if solution is infeasible

Examples

output = SSmSB(input)
Usage
Interface function to a Global optimization algorithm for 
MINLP's based on Scatter Search. 

Note that the optimization method itself is not included
in the toolbox but that it can be downloaded. For further information,
please click on the "Download" link on the SBTOOLBOX2.org webpage.
 
SSm attempts to solve problems of the form:
   min F(x) s. t.:  ceq(x) = 0 (equality constraints)
     x    
	 	c_L <= c(x) <= c_U (inequality constraints)
        x_L <=  x   <= x_U (bounds on the decision variables)
 
If you use SSm and publish the results, please cite the following 
papers:
 
Egea, J.A., M. Rodriguez-Fernandez, J. R. Banga and R. Martí (2007) 
Scatter Search for chemical and bioprocess optimization. Journal of 
Global Optimization 37(3):481-503.
 
Rodriguez-Fernandez, M., J. A. Egea and J. R. Banga (2006) Novel 
Metaheuristic for Parameter Estimation in Nonlinear Dynamic 
Biological Systems. BMC Bioinformatics 7:483.
  
USAGE:
======
[info] = SSmSB()
[X,FVAL,result] = SSmSB(FUN,X,OPTIONS)
 
FUN: Function to optimize
X: Starting Guess (Not strictly required but kept for the sake of
   compatible optimization function calls)
OPTIONS: structure containing options for the algorithm:
       OPTIONS.vtr: cost function value to reach
       OPTIONS.highbounds: vector containing upper bounds for
          parameters. Instead of a vector highbounds can also be
          a scalar > 1. In the latter case the highbounds are
          determined by multiplying this scalar to the initial
          parameter guess X. This latter case works only for
          positive X(i) ... if negative present then the user needs
          to specify a whole highbounds vector.
       OPTIONS.lowbounds: vector containing lower bounds for
          parameters. Instead of a vector lowbounds can also be a
          scalar < 1. In the latter case the lowbounds are
          determined by multiplying this scalar to the initial
          parameter guess X. This latter case works only for
          positive X(i) ... if negative present then the user
          needs to specify a whole lowbounds vector.
User options
       OPTIONS.maxfunevals: Maximum number of function evaluations
       OPTIONS.maxtime: Maximum time (in minutes) for optimization
       OPTIONS.silent: =0: output of info, =1: no output
       OPTIONS.plot. Plots convergence curves: 
              0-Deactivated,
              1-Plot curves on line,
              2-Plot final results
       OPTIONS.weight: Weight that multiplies the penalty term added
          to the objective function in constrained problems
       OPTIONS.log_var: Indexes of the variables which will be used
          to generate diverse solutions in different orders of
          magnitude
Global options
       OPTIONS.dim_refset: Number of elements in Refset
       OPTIONS.ndiverse: Number of solutions generated by the
          diversificator 
       OPTIONS.initiate: Type of Refset initialization
              0: Take bounds, middle point and fill by euclidean
                 distance
              1: Evaluate all the diverse solutions,take the
                 dim_refset/2 best solutions and fill by
                 euclidean distance
       OPTIONS.combination: Type of combination of Refset elements
              1: hyper-rectangles
              2: linear combinations
       OPTIONS.regenerate: Type of Refset regeneration 
              1: Regeneration by distance diversity
              2: Regeneration by direction diversity
              3: Randomly alternates 1 and 2
       OPTIONS.delete: Maximum number of Refset elements
          deleted when regenerating Refset
              'standard': Maximum deleted elements=dim_refset/2 
                         (half of the elements)
              'aggressive': Delete dim_refset-1 (all of them 
                         except the best solution found)
       OPTIONS.intens: Iteration interval between intensifications
       OPTIONS.tolfun: Function tolerance for joining the Refset
       OPTIONS.diverse_criteria: Criterion for diversification in
          the Refset
              1: euclidean distance
              2: tolerances
       OPTIONS.tolx: Variable tolerance for joining the Refset when
          the euclidean distance is deactivated
Local options
       OPTIONS.local.solver: Choose local solver:
          0: local search off, 'constrnew','fminsearch',
          'nomad','solnp','n2fb','dn2fb','dhc','fsqp','ipopt',
          'misqp','lsqnonlin'
       OPTIONS.local.n1: Number of function evaluations before
          applying local search for the 1st time
       OPTIONS.local.n2: Minimum number of function evaluations
          in the global phase between 2 local calls
 
Output Arguments:
=================
info:     calling the function w/o input argument returns
          information about the options and a flag indicating if
          the algorithm can handle constraints or not
X:        Found solution
FVAL:     Value of the function FUN at X
result:   Structure containing results

  result.fbest                   = Best objective function value
                                   found after the optimization
  result.xbest                   = Vector providing the best
                                   function value
  result.cpu_time                = Time in seconds consumed in the
                                   optimization
  result.f                       = Vector containing the best
                                   objective function value after
                                   each iteration
  result.x                       = Matrix containing the best vector
                                   after each iteration
  result.time                    = Vector containing the cpu time
                                   consumed after each iteration
  result.neval                   = Vector containing the number of
                                   function evaluations after each
                                   iteration
  result.numeval                 = Number of function evaluations
  result.local_solutions         = Local solutions found by the
                                   local solver (in rows)
  result.local_solutions_values  = Function values of the local
                                   solutions
  result.end_crit                = Criterion to finish the
                                   optimization
                                   1: Maximal number of function
                                      evaluations achieved
                                   2: Maximum allowed CPU Time
                                      achieved
                                   3: Value to reach achieved
 
  DEFAULT VALUES:
  ===============
  OPTIONS.lowbounds:        0.1  => lowbounds = 0.1*X 
  OPTIONS.highbounds:       10  => highbounds = 10*X 
  OPTIONS.maxfunevals:      400*ndim
  OPTIONS.maxtime:          120 (minutes)        
  OPTIONS.silent:           0          
  OPTIONS.plot              0
  OPTIONS.weight:           1000
  OPTIONS.log_var:          [1:ndim] (all variables)

  OPTIONS.dim_refset:       'auto'
  OPTIONS.ndiverse:         10*ndim
  OPTIONS.initiate:         1
  OPTIONS.combination:      1
  OPTIONS.regenerate:       3
  OPTIONS.delete:           'standard'
  OPTIONS.intens:           10
  OPTIONS.tolfun:           1e-4
  OPTIONS.diverse_criteria: 1
  OPTIONS.tolx:             1e-3      

  OPTIONS.local.solver:     'dn2fb'
  OPTIONS.local.n1:         100*ndim
  OPTIONS.local.n2:         200*ndim
Examples

output = fSSmSB(input)
Usage
Interface function to a Global optimization algorithm for 
MINLP's based on Scatter Search ("fast" version). 

Please have a look at SSmSB. The calling syntax and the
options are the same.

Note that the optimization method itself is not included
in the toolbox but that it can be downloaded. For further information,
please click on the "Download" link on the SBTOOLBOX2.org webpage.
Examples

output = pswarmSB(input)
Usage Particle swarm pattern search algorithm for global optimization.

Algorithm developed by A. Ismael F. Vaz and L. N. Vicente. aivaz@dps.uminho.pt 04/04/2007 More information: http://www.norg.uminho.pt/aivaz/pswarm/

In case of a publication that was prepared using pswarm, users are asked to cite the following publication: A. I. F. Vaz and L. N. Vicente, A particle swarm pattern search method for bound constrained global optimization, Journal of Global Optimization, 39 (2007) 197-219.

The PSwarm algorithm takes advantage of the particle swarm algorithm in looking for a global optimum in the search phase of the pattern search algorithm. The pattern search enforces convergence for a local optimum.

If the global variable stopOptimization is set to 1, the optimization is stopped. This allows for stopping parameter estimation functions on user request.

input=[FUN,X]
input=[FUN,X,OPTIONS]

FUN: Function to minimize
X: Starting Guess for parameter vector
OPTIONS: Structure containing options for the algorithm:
OPTIONS.lowbounds: vector containing lower bounds for parameters (default: 1e-3*X).
OPTIONS.highbounds: vector containing upper bounds for parameters (default: 1e3*X).
OPTIONS.Cognitial: cognitial parameter in the velocity equation (default: 0.5).
OPTIONS.InerciaFinalWeight: The value of the inercia parameter in the velocity at last iteration (default: 0.4).
OPTIONS.InerciaInitialWeight: The value of the inercia parameter in the velocity equation at first iteration (default: 0.9).
OPTIONS.MaxObj: Maximum number of objective function evaluations. Since the algorithm is population based this maximum number of objective function evaluation may be sligtly exceeded (default: 5000*length(X)).
OPTIONS.MaxIter: Maximum number of iterations allowed (default: 1000*length(X)).
OPTIONS.Size: Population size (default: 20*length(X)).
OPTIONS.Social: Social parameter in the velocity equation (default: 0.5).
OPTIONS.MaxVelocityFactor: Velocity will be projected in the set (UB-LB)*MaxVelocityFactor (default: 0.5).
OPTIONS.CPTolerance: Stopping criteria tolerance (default: 1e-5).
OPTIONS.InitialDelta: Initial pattern search grid step (default: 2).
OPTIONS.DeltaIncreseFactor: Delta will be increased by this factor (on successful poll steps) (default: 2).
OPTIONS.DeltaDecreaseFactor: Delta willbe decreased by this factor (on unsuccessful poll steps) (default: 0.5).
OPTIONS.InitialDeltaFactor: The inicial Delta will be the min(UB-LB) times this factor (default: 5).
OPTIONS.silent: silent level. 1 to be verbose and 0 to be silent (default: 1).

output = [X,FVAL,EXITFLAG]

X: Best feasible individual ([] if EXITFLAG = 0)
FVAL: Value of the function FUN at X ([] if EXITFLAG = 0)
RunData: Some statistics obout the algorithm run

Examples

Solvers

[output] = fsolveSB(input)
Usage This functions attempts to solve equations of the form FUN(X)=0 where FUN and X may be vectors. Newton iteration.

input = [FUN,X,OPTIONS]

FUN: Name of the function to solve (string).
X: Starting guess (vector).
OPTIONS: Structure with options for the algorithm.
OPTIONS.MaxIter: Maximum number of iterations (default: 1000).
OPTIONS.TolFun: Tolerance for max element in function evaluation (default: 1e-12).
OPTIONS.Delta: Step length for numerical differentiation to obtain the Jacobian (default: 1e-6).

output = [X,FVAL,EXITFLAG]

X: Fond solution.
FVAL: Value of the FUN(x) at x=X.
EXITFLAG: 1=success, 0=not found.

Examples

Statistics

[output] = princompSB(input)
Usage
Compute principal components of X
 
USAGE:
======
[pc,z,w,Tsq] = princomp(X)
 
pc:  the principal components
z:   the transformed data
w:   the eigenvalues of the covariance matrix
Tsq: Hotelling's T^2 statistic for the transformed data
Examples

[output] = clusteringSB(input)
Usage
Performs UPGMA on distance matrix and produces a
denddrogram plot.
  
Initially, each object is in its own cluster. At each step, 
the nearest 2 clusters are combined into a higher-level cluster. 
The distance between any 2 clusters A and B is taken to be the 
average of all distances between pairs of objects "a" in A and 
"b" in B. 
 
USAGE:
======
[] = clusteringSB(dist,labels,fontsize)       
[topology] = clusteringSB(dist,labels,fontsize)

dist:     [n x n] symmetric distance matrix
labels:   optional [n x q] matrix of group labels for dendrogram
fontsize: optional font size for labels [default = 10]

If no output argument is specified, the dendrogram is plotted. 
Otherwise the topology is returned to the workspace.
Examples

[output] = pdistSB(input)
Usage
Determines the distance matrix for a set of points whose
coordinates are given as row-vectors in the data matrix.

USAGE:
======
D = pdistSB(datamatrix)
D = pdistSB(datamatrix, method) 

datamatrix: datamatrix is an NxP matrix of coordinates for N points
            in P dimensions
method: is an integer between 1 and 3 representing the chosen
        method for computing the distance matrix (see note below)
 
DEFAULT VALUES:
===============
method: method chosen problem size dependend if not specified
 
Output Arguments:
=================
D: An NxN matrix, where the value of DMAT(i,j) corresponds to
   the distance from datamatrix(i,:) to datamatrix(j,:)

Note:
=====
method=1: Usually fastest for small inputs. Takes advantage of the 
          symmetric property of distance matrices to perform
          half as many calculations
method=2: Usually fastest for medium inputs. Uses a fully 
          vectorized method
method=3: Usually fastest for large inputs. Uses a partially 
          vectorized method with relatively small memory  
          requirement
Examples

[output] = prctileSB(input)
Usage
This function determines the percentiles of a sample, based on
interpolation.
 
USAGE:
======
[output] = prctileSB(data,p)        

data:  column vector of matrix where each sample corresponds
       to one column
p: vector of percentage values to calculate the percentiles for
 
Output Arguments:
=================
output: column vector with same length as p, containing the 
        percentiles for the given percentages in p.
Examples

boxplotSB(input)
Usage
Plots a box-and-whisker diagram for the given data. The two sides 
(green color) of the box define the lower and upper quartile. The
red line corresponds to the median. The whiskers are the blue 
lines. Outliers are depicted as black dots.
 
USAGE:
======
boxplotSB(data)        
boxplotSB(OPTIONS)        
 
data:   column vector of matrix where each sample corresponds to 
	    one column
OPTIONS: structure containing options for the function
      OPTIONS.samplenames: Cell-array with names or other 
	    information of the samples
      OPTIONS.boxWidth: Width of the boxes to be drawn
      OPTIONS.whiskerLength: Whisker length relative to the length 
	    of the box
      OPTIONS.verticalFlag: Flag determining if the boxes are 
	    oriented vertically (=1) or horizontally (=0)
 
DEFAULT VALUES:
===============
OPTIONS.samplenames:    {'Sample 1','Sample 2', ...}
OPTIONS.boxWidth:       0.5
OPTIONS.whiskerLength:  1.5 (standard)
OPTIONS.verticalFlag:   0 (plot horizontally)
Examples

output = chi2cdfSB(input)
Usage
  Cumulative density function of the chi-square distribution
 
  USAGE:
  ======
  cdf = chi2cdfSB(x, n)
 
  For each element of 'x', compute the cumulative distribution
  function (CDF) at 'x' of the chisquare distribution with 'n'
  degrees of freedom.
Examples

output = chi2invSB(input)
Usage
  Quantile function of the chi-square distribution
 
  USAGE:
  ======
  inv = chi2invSB(x, n)
 
  For each element of 'x', compute the quantile (the inverse of the
  CDF) at 'x' of the chisquare distribution with 'n' degrees of
  freedom.
Examples

output = chi2pdfSB(input)
Usage
  Probability density function of the chi-square distribution
 
  USAGE:
  ======
  pdf = chi2pdfSB(x, n)
 
  For each element of 'x', compute the probability density function
  (PDF) at 'x' of the chisquare distribution with 'n' degrees
  of freedom.
Examples

output = tcdfSB(input)
Usage
  Cumulative density function of the t distribution
 
  USAGE:
  ======
  cdf = tcdfSB(x, n)
 
  For each element of 'x', compute the CDF at 'x' of the
  t (Student) distribution with 'n' degrees of freedom, i.e.,
  PROB (t(n) <= x).
Examples

output = tinvSB(input)
Usage
  Quantile function of the t distribution
 
  USAGE:
  ======
  inv = tinvSB(x, n)
 
  For each component of 'x', compute the quantile (the inverse of
  the CDF) at 'x' of the t (Student) distribution with parameter
  'n'.
Examples

output = tpdfSB(input)
Usage
  Probability density function of the t distribution
 
  USAGE:
  ======
  pdf = tpdfSB(x, n)
 
  For each element of 'x', compute the probability density function
  (PDF) at 'x' of the t (Student) distribution with 'n'
  degrees of freedom. 
Examples

output = gamcdfSB(input)
Usage
  Cumulative density function of the Gamma distribution
 
  USAGE:
  ======
  cdf = gamcdfSB(x, a, b)
 
  For each element of 'x', compute the cumulative distribution
  function (CDF) at 'x' of the Gamma distribution with parameters
  'a' and 'b'.
Examples

output = gaminvSB(input)
Usage
  Quantile function of the Gamma distribution
 
  USAGE:
  ======
  inv = gaminvSB(x, a, b)
 
  For each component of 'x', compute the quantile (the inverse of
  the CDF) at 'x' of the Gamma distribution with parameters 'a'
  and 'b'.
Examples

output = gampdfSB(input)
Usage
  Probability density function of the Gamma distribution
 
  USAGE:
  ======
  pdf = gampdfSB(x, a, b)
 
  For each element of 'x', return the probability density function
  (PDF) at 'x' of the Gamma distribution with parameters 'a'
  and 'b'.
Examples

output = normcdfSB(input)
Usage
  Cumulative densitiy function of the normal distribution
 
  USAGE:
  ======
  cdf = normcdfSB(x, m, s)
 
  For each element of 'x', compute the cumulative distribution
  function (CDF) at 'x' of the normal distribution with mean
  'm' and standard deviation 's'.
 
  Default values are 'm' = 0, 's' = 1.
Examples

output = norminvSB(input)
Usage
  Quantile function of the normal distribution
 
  USAGE:
  ======
  pdf = norminvSB(x, m, s)
 
  For each element of 'x', compute the quantile (the inverse of the
  CDF) at 'x' of the normal distribution with mean 'm' and
  standard deviation 's'.
 
  Default values are 'm' = 0, 's' = 1.
Examples

output = normpdfSB(input)
Usage
  Probability density function of the normal distribution
 
  USAGE:
  ======
  pdf = normpdfSB(x, m, s)
 
  For each element of 'x', compute the probability density function
  (PDF) at 'x' of the normal distribution with mean 'm' and
  standard deviation 's'.
 
  Default values are 'm' = 0, 's' = 1.
Examples

output = swtestSB(input)
Usage
Shapiro-Wilk parametric hypothesis test of composite normality.

USAGE:
======
[H, pValue, SWstatistic] = swtestSB(x)
[H, pValue, SWstatistic] = swtestSB(x, alpha)
[H, pValue, SWstatistic] = swtestSB(x, alpha, tail)
 
This function performs the Shapiro-Wilk test to determine if the
null hypothesis of composite normality is a reasonable assumption
regarding the population distribution of a random sample x. The
desired significance level, alpha, is an optional scalar input
(default = 0.05). tail indicates the type of test (default = 1).
 
The Shapiro-Wilk hypotheses are: 
Null Hypothesis: x is normal with unspecified mean and variance.
   For tail =  0 (2-sided test), alternative: x is not normal.
   For tail =  1 (1-sided test), alternative: x is upper the normal.
   For tail = -1 (1-sided test), alternative: x is lower the normal.
 
This is an omnibus test, and is generally considered relatively
powerful against a variety of alternatives.
Shapiro-Wilk test is better than the Shapiro-Francia test for
Platykurtic sample. Conversely, Shapiro-Francia test is better than
the Shapiro-Wilk test for Leptokurtic samples.
 
When the series 'x' is Leptokurtic, swtestSB performs the 
Shapiro-Francia test, else (series 'x' is Platykurtic) swtestSB 
performs the Shapiro-Wilk test.
  
Inputs:
  x - a vector of deviates from an unknown distribution. The 
    observation number must exceed 3 and be less than 5000.

Optional inputs:
  alpha - The significance level for the test (default = 0.05).
  tail  - The type of the test (default = 1).

Outputs:
  SWstatistic - The test statistic (non normalized).
 
  pValue - is the p-value, or the probability of observing the
    given result by chance given that the null hypothesis is true.
	Small values of pValue cast doubt on the validity of the null
	hypothesis.
 
  H = 0 => Do not reject the null hypothesis at significance level
    alpha.
  H = 1 => Reject the null hypothesis at significance level 
    alpha.
 
References: Royston P. "Algorithm AS R94", Applied Statistics (1995)
  Vol. 44, No. 4. AS R94 -- calculates Shapiro-Wilk normality test
  and P-value for sample sizes 3 <= n <= 5000. Handles censored or
  uncensored data. Corrects AS 181, which was found to be inaccurate
  for n > 50.
Examples

Signal

output = xcorrSB(input)
Usage
Compute correlation R_xy of X and Y for various lags k:  
 
   R_xy(k) = sum_{i=1}^{N-k}{x_i y_{i-k}}/(N-k),  for k >= 0
   R_xy(k) = R_yx(-k),  for k <= 0
 
usage: [R, lag] = xcorrSB(X)
usage: [R, lag] = xcorrSB(X, Y)
usage: [R, lag] = xcorrSB(X, Y, maxlag)
usage: [R, lag] = xcorrSB(X, Y, maxlag, scale)
 
Returns R(k+maxlag+1)=Rxy(k) for lag k=[-maxlag:maxlag].
Scale is one of:
   'biased'   for correlation=raw/N, 
   'unbiased' for correlation=raw/(N-|lag|), 
   'coeff'    for correlation=raw/(correlation at lag 0),
   'none'     for correlation=raw
If Y is omitted, compute autocorrelation.  
If maxlag is omitted, use N-1 where N=max(length(X),length(Y)).
If scale is omitted, use 'none'.
 
If X is a matrix, computes the cross correlation of each column
against every other column for every lag.  The resulting matrix has
2*maxlag+1 rows and P^2 columns where P is columns(X). That is,

   R(k+maxlag+1,P*(i-1)+j) == Rij(k) for lag k=[-maxlag:maxlag],
so
   R(:,P*(i-1)+j) == xcorr(X(:,i),X(:,j))
and
   reshape(R(k,:),P,P) is the cross-correlation matrix for X(k,:).
 
xcorr computes the cross correlation using an FFT, so the cost is
dependent on the length N of the vectors and independent of the
number of lags k that you need.  If you only need lags 0:k-1 for 
vectors x and y, then the direct sum may be faster:
 
unbiased:
 ( hankel(x(1:k),[x(k:N); zeros(k-1,1)]) * y ) ./ [N:-1:N-k+1](:)
biased:
 ( hankel(x(1:k),[x(k:N); zeros(k-1,1)]) * y ) ./ N

If length(x) == length(y) + k, then you can use the simpler
   ( hankel(x(1:k),x(k:N-k)) * y ) ./ N
 
Ref: Stearns, SD and David, RA (1988). Signal Processing Algorithms.
     New Jersey: Prentice-Hall.
Examples

output = resampleSB(input)
Usage
resampleSB: resamples time series x1, which is sampled at the time
instances t1 to time series x2 using a sampling defined by t2.
 
t2: scalar representing sampling interval or vector of sampling 
  instances
method: 'zoh', 'linear', 'cubic'. The use of 'method' is optional.
        (default: 'linear')
 
The output t2 is the vector that has been used for the resampling.
Examples

output = postpadSB(input)
Usage
postpadSB: Appends value c (default: 0) until to extend vector 
x to a length of l. Same with matrices x, where the dimension 
to extend is given by dim (default: 1). 

y = postpadSB(x, l)
y = postpadSB(x, l, c)
y = postpadSB(x, l, c, dim)
Examples

output = prepadSB(input)
Usage
prepadSB: prepends value c (default: 0) until to extend vector 
x to a length of l. Same with matrices x, where the dimension 
to extend is given by dim (default: 1). 

y = prepadSB(x, l)
y = prepadSB(x, l, c)
y = prepadSB(x, l, c, dim)
Examples

output = centeredfftSB(input)
Usage
centeredfftSB: Uses the fft function of MATLAB to 
determine a two sided spectrum of x, where te data 
in x have been sampled with the frequency Fs. 
 
[X,freq] = centeredfftSB(x,Fs)
Examples

output = positivefftSB(input)
Usage
positivefftSB: Uses the fft function of MATLAB to 
determine a one sided spectrum of x, where te data 
in x have been sampled with the frequency Fs. 
 
[X,freq] = positivefftSB(x,Fs)
Examples

Auxiliary functions

Auxiliary functions
Usage The following functions are not documented in detail in this manual. To obtain more information please type in MATLAB:

>> help "functionname"

"functionname":

explodePCSB
extractPSB

andSB
orSB

piecewiseSB
interp0SB
interp1SB
interpcsSB
interpcseSB
interpcseSlopeSB
interpcsexSB

delaySB

SBPOP PUBLICATIONS

Publications, discussing results obtained with the help of the SBPOP PACKAGE, are asked to reference the most relevant of the following papers and additionally the link to this webpage:

  • Systems Biology Toolbox for MATLAB: A computational platform for research in Systems Biology, Bioinformatics, 22(4), 514-515, 2006, doi:10.1093/bioinformatics/bti799
  • SBaddon: high performance simulation for the Systems Biology Toolbox for MATLAB, Bioinformatics, 23(5), 646-647, 2007, doi:10.1093/bioinformatics/btl668
  • SBPOP Package: Efficient support for model based drug development – from mechanistic models to complex trial simulation, PAGE meeting, Glasgow, UK [abstract]
  • Enhancing population pharmacokinetic modeling efficiency and quality using an integrated workflow, Journal of Pharmacokinetics and Pharmacodynamics, doi:10.1007/s10928-014-9370-4, 2014.
SBPOP NEWS
  • 16th March 2015: Many small improvements ... also SBML export now fully working again
  • 20th January 2015: Many improvements ... Windows 64bit support and compatibility with MATLAB versions >=R2014B
  • 28th July 2014: Happy to announce that our paper about efficient conduct of popPK anlalyses has been published (doi:10.1007/s10928-014-9370-4)
  • 3rd July 2014: Update to Revision 1361 (due to packaging bug in Rev 1352)
  • 18th June 2014: Update to Revision 1352 (popPK modeling workflow MONOLIX and NONMEM, "median" modeling support)
  • 25th March 2014: Update to Revision 1278
  • 7th May 2013: Revision 1172 had a minor bug due to packaging of the public version - main impact on running SBPDgui. Fixed now in Revision 1176
  • 2nd May 2013: SBTOOLBOX2 and SBPD are now integrated into the same package, called "SBPOP PACKAGE". The new combined package additionally includes "SBPOP", focusing on PK/PKPD/PBPK models, population modeling, nonlinear mixed effect parameter estimation, clinical trial simulation