Download Links

Simulate 3D | SBW (Win32) | Bifurcation Discovery | FluxBalance

Monday, March 8, 2010

Getting Started with LibSedML (on linux)

A couple of days ago I announced the LibSedML sourceforge project, a library for reading / writing SED-ML files. However, what was missing so far is information on how one would start using the library. (If you feel lucky, I provided a binary at the end of this post!)

Preparing the Virtual Machine

In the following, I’ll describe how to set up an OpenSuse 11.2 Virtual Machine, in order to run SED-ML Simulation Experiments:

  1. Actually, we are not setting up the virtual machine, but instead take the one provided by the Mono team. Simply download the VMware image from:

    http://mono-project.com/Downloads

    unzip and start the Virtual Machine. It will automatically log in as user ‘rupert’
  2. The first thing we might want to do is to get SBW started. While not strictly necessary … it will help us later on, when we just copy the binary libraries for LibSedMLRunner to execute the simulations. The Latest SBW version for linux can be found here:

    http://sourceforge.net/projects/jdesigner/files/Systems%20Biology%20Workbench/2.7.10/SBW-2.7.10-linux-installer.bin/download

    The file is simply installed by making it executable (chmod +x SBW-*bin) and executing the binary installer.
  3. Next we might want to install a fresh copy of LibSBML, which is easily done by checking out libsbml from SVN:

    svn co http://sbml.svn.sourceforge.net/svnroot/sbml/trunk/libsbml libsbml

    the virtual machine at this point has no g++ so we get one by going to a root shell (root password is ‘mono’) and installing:

    zypper install gcc-c++
    zypper install libxml2-devel

    (i also installed additional packages like ‘lapack’ but I’m not sure they are necessary)
  4. Next we get the latest SWIG from http://www.swig.org/download.html, I just downloaded the 1.3.40 version, unpacked it with tar zxf, ran:

    ./configure && make && sudo make install

    which installes SWIG into /usr/local
  5. Now we can compile and run libsbml:

    ./configure --with-libxml=/usr --with-swig=/usr/local --with-csharp --enable-layout=no && make

    which will compile libsbml and create the bindings in the src/bindings/csharp folder

Compiling LibSedML

So far for the prerequisites. The remaining could not be simpler. Here the whole session:

Directory: /home/rupert/Desktop
Tue Mar 9 02:35:51 UTC 2010
rupert@linux:~/Desktop> cd
rupert@linux:~> cd Development/
rupert@linux:~/Development> l
stotal 12
drwxr-xr-x 3 rupert users 4096 2010-03-08 20:20 ./
drwxr-xr-x 33 rupert users 4096 2010-03-08 22:21 ../
drwxr-xr-x 8 rupert users 4096 2010-03-08 20:21 sbwbuild/
rupert@linux:~/Development> svn co http://libsedml.svn.sourceforge.net/svnroot/libsedml/trunk LibSedML
A LibSedML/ICON_MIASE.ico
A LibSedML/SEDML.sln
A LibSedML/libSedMLScript
A LibSedML/libSedMLScript/HelperFunctions.py
A LibSedML/libSedMLScript/libSedMLScript.csproj
A LibSedML/libSedMLScript/SedMLPythonConverter.cs
A LibSedML/libSedMLScript/ITextImporter.cs
A LibSedML/libSedMLScript/ITextExporter.cs
A LibSedML/libSedMLScript/Properties
A LibSedML/libSedMLScript/Properties/AssemblyInfo.cs
A LibSedML/libSedMLScript/Properties/Resources.resx
A LibSedML/libSedMLScript/Properties/Resources.Designer.cs
A LibSedML/libSedMLScript/SedMLScript.cs
A LibSedML/SedMLWeb
A LibSedML/SedMLWeb/Default.aspx.designer.cs
A LibSedML/SedMLWeb/MasterASPX.master
A LibSedML/SedMLWeb/SedMLWeb.csproj
A LibSedML/SedMLWeb/Web.config
A LibSedML/SedMLWeb/Default.aspx.cs
A LibSedML/SedMLWeb/_sysbiostyles.css
A LibSedML/SedMLWeb/MasterASPX.master.cs
A LibSedML/SedMLWeb/SysBio_MasterASPX.master
A LibSedML/SedMLWeb/KGI0717_MasterASPX.master
A LibSedML/SedMLWeb/Properties
A LibSedML/SedMLWeb/Properties/AssemblyInfo.cs
A LibSedML/SedMLWeb/SysBio_MasterASPX.master.cs
A LibSedML/SedMLWeb/Default.aspx
A LibSedML/SedMLWeb/KGI0717_MasterASPX.master.cs
A LibSedML/Samples
A LibSedML/Samples/model1.xml
A LibSedML/Samples/sedmltest.txt
A LibSedML/Samples/curien.xml
A LibSedML/Samples/EllowitzRepressilator.miase
A LibSedML/Samples/lorenz.txt
A LibSedML/Samples/BIOMD0000000021.xml
A LibSedML/Samples/miaseTest.xml
A LibSedML/Samples/sedmlCurienJWS.xml
A LibSedML/Samples/JanaWolf.miase
A LibSedML/Samples/miaseBioModels21.xml
A LibSedML/Samples/brusselator.miase
A LibSedML/Samples/brusselator.xml
A LibSedML/Samples/lorenz.miase
A LibSedML/Samples/lorenz.xml
A LibSedML/Samples/sedMLBIOM21.miase
A LibSedML/Samples/sedMLBIOM21.xml
A LibSedML/libSedMLRunner
A LibSedML/libSedMLRunner/SedMLRunner.cs
A LibSedML/libSedMLRunner/libSedMLRunner.csproj
A LibSedML/libSedMLRunner/RunResult.cs
A LibSedML/libSedMLRunner/SimpleRunner.cs
A LibSedML/libSedMLRunner/Properties
A LibSedML/libSedMLRunner/Properties/AssemblyInfo.cs
A LibSedML/SedMLConsole
A LibSedML/SedMLConsole/ICON_MIASE.ico
A LibSedML/SedMLConsole/Web References
A LibSedML/SedMLConsole/Web References/BioModels
A LibSedML/SedMLConsole/Web References/BioModels/Reference.cs
A LibSedML/SedMLConsole/Web References/BioModels/BioModelsWebServices.wsdl
A LibSedML/SedMLConsole/Web References/BioModels/Reference.map
A LibSedML/SedMLConsole/Web References/MIRIAM
A LibSedML/SedMLConsole/Web References/MIRIAM/Reference.cs
A LibSedML/SedMLConsole/Web References/MIRIAM/MiriamWebServices.wsdl
A LibSedML/SedMLConsole/Web References/MIRIAM/Reference.map
A LibSedML/SedMLConsole/SedMLConsole.csproj.user
A LibSedML/SedMLConsole/app.config
A LibSedML/SedMLConsole/SedMLConsole.csproj
A LibSedML/SedMLConsole/Resources
A LibSedML/SedMLConsole/Resources/ICON_MIASE.ico
A LibSedML/SedMLConsole/Program.cs
A LibSedML/SedMLConsole/Properties
A LibSedML/SedMLConsole/Properties/AssemblyInfo.cs
A LibSedML/SedMLConsole/Properties/Settings.settings
A LibSedML/SedMLConsole/Properties/Settings.Designer.cs
A LibSedML/SedMLConsole/Properties/Resources.resx
A LibSedML/SedMLConsole/Properties/Resources.Designer.cs
A LibSedML/3rdParty
A LibSedML/3rdParty/Microsoft.Scripting.ExtensionAttribute.dll
A LibSedML/3rdParty/LibRoadRunner.dll
A LibSedML/3rdParty/Microsoft.Scripting.dll
A LibSedML/3rdParty/IronPython.dll
A LibSedML/3rdParty/ICSharpCode.SharpZipLib.dll
A LibSedML/3rdParty/mathLibrary.dll
A LibSedML/3rdParty/CompareData.dll
A LibSedML/3rdParty/IronPython.Modules.dll
A LibSedML/3rdParty/ZedGraph.Web.dll
A LibSedML/3rdParty/Microsoft.Dynamic.dll
A LibSedML/3rdParty/SBMLSupport.dll
A LibSedML/3rdParty/libsbmlcsP.dll
A LibSedML/3rdParty/SBWCSharp.dll
A LibSedML/3rdParty/Microsoft.Scripting.Core.dll
A LibSedML/3rdParty/LibStructuralCSharp.dll
A LibSedML/3rdParty/Microsoft.Scripting.Debugging.dll
A LibSedML/3rdParty/ZedGraph.dll
A LibSedML/SedMLScript
A LibSedML/SedMLScript/ICON_MIASE.ico
A LibSedML/SedMLScript/MainForm.resx
A LibSedML/SedMLScript/SedMLScriptTest.csproj
A LibSedML/SedMLScript/MainForm.Designer.cs
A LibSedML/SedMLScript/Program.cs
A LibSedML/SedMLScript/icons
A LibSedML/SedMLScript/icons/run.png
A LibSedML/SedMLScript/MainForm.cs
A LibSedML/SedMLScript/Properties
A LibSedML/SedMLScript/Properties/AssemblyInfo.cs
A LibSedML/SedMLScript/Properties/Settings.settings
A LibSedML/SedMLScript/Properties/Settings.Designer.cs
A LibSedML/SedMLScript/Properties/Resources.resx
A LibSedML/SedMLScript/Properties/Resources.Designer.cs
A LibSedML/libSedML
A LibSedML/libSedML/Report.cs
A LibSedML/libSedML/Util.cs
A LibSedML/libSedML/ModelStore.cs
A LibSedML/libSedML/UniformTimeCourse.cs
A LibSedML/libSedML/TaskStore.cs
A LibSedML/libSedML/DataGenerator.cs
A LibSedML/libSedML/Parameter.cs
A LibSedML/libSedML/SedMLInfo.cs
A LibSedML/libSedML/Simulation.cs
A LibSedML/libSedML/Variable.cs
A LibSedML/libSedML/Change.cs
A LibSedML/libSedML/libSedML.csproj
A LibSedML/libSedML/Properties
A LibSedML/libSedML/Properties/AssemblyInfo.cs
A LibSedML/libSedML/DataGeneratorStore.cs
A LibSedML/libSedML/SedMLBase.cs
A LibSedML/libSedML/Output.cs
A LibSedML/libSedML/Model.cs
A LibSedML/libSedML/SimulationStore.cs
A LibSedML/libSedML/Task.cs
A LibSedML/libSedML/Plot2D.cs
A LibSedML/IronPythonScript
Checked out revision 4.
rupert@linux:~/Development> cd LibSedML/
rupert@linux:~/Development/LibSedML> ls
3rdParty libSedML Samples SEDML.sln
ICON_MIASE.ico libSedMLRunner SedMLConsole SedMLWeb
IronPythonScript libSedMLScript SedMLScript
rupert@linux:~/Development/LibSedML> mdtool build -c:Release
MonoDevelop Build Tool
Loading solution: ./SEDML.sln
Loading solution: ./SEDML.sln
Loading projects ..
Building: SEDML (Release)
Building Solution SEDML
Building: libSedML (Release)
Performing main compilation...
/usr/bin/gmcs /noconfig
"/out:/home/rupert/Development/LibSedML/bin/libSedML.dll"
"/r:/home/rupert/Development/LibSedML/3rdParty/CompareData.dll"
"/r:/home/rupert/Development/LibSedML/3rdParty/ICSharpCode.SharpZipLib.
dll" "/r:/home/rupert/Development/LibSedML/3rdParty/libsbmlcsP.dll"
"/r:/home/rupert/Development/LibSedML/3rdParty/mathLibrary.dll"
"/r:/home/rupert/Development/LibSedML/3rdParty/SBMLSupport.dll"
"/r:/home/rupert/Development/LibSedML/3rdParty/SBWCSharp.dll"
"/r:System.dll" "/r:System.Data.dll" "/r:System.Xml.dll" /nologo
/warn:4 /optimize+ /codepage:utf8 /platform:x86 "/define:TRACE"
/t:library "/home/rupert/Development/LibSedML/libSedML/Change.cs"
"/home/rupert/Development/LibSedML/libSedML/DataGenerator.cs"
"/home/rupert/Development/LibSedML/libSedML/DataGeneratorStore.cs"
"/home/rupert/Development/LibSedML/libSedML/SedMLBase.cs"
"/home/rupert/Development/LibSedML/libSedML/SedMLInfo.cs"
"/home/rupert/Development/LibSedML/libSedML/Model.cs"
"/home/rupert/Development/LibSedML/libSedML/ModelStore.cs"
"/home/rupert/Development/LibSedML/libSedML/Output.cs"
"/home/rupert/Development/LibSedML/libSedML/Parameter.cs"
"/home/rupert/Development/LibSedML/libSedML/Plot2D.cs"
"/home/rupert/Development/LibSedML/libSedML/Properties/AssemblyInfo.cs"
"/home/rupert/Development/LibSedML/libSedML/Report.cs"
"/home/rupert/Development/LibSedML/libSedML/Simulation.cs"
"/home/rupert/Development/LibSedML/libSedML/SimulationStore.cs"
"/home/rupert/Development/LibSedML/libSedML/Task.cs"
"/home/rupert/Development/LibSedML/libSedML/TaskStore.cs"
"/home/rupert/Development/LibSedML/libSedML/UniformTimeCourse.cs"
"/home/rupert/Development/LibSedML/libSedML/Util.cs"
"/home/rupert/Development/LibSedML/libSedML/Variable.cs"
Compilation succeeded - 1 warning(s)

/home/rupert/Development/LibSedML/libSedML/Util.cs(307,18): warning
CS0219: The variable `length' is assigned but its value is never used


Build complete -- 0 errors, 1 warning
Building: libSedMLRunner (Release)
Performing main compilation...
/usr/bin/gmcs /noconfig
"/out:/home/rupert/Development/LibSedML/bin/libSedMLRunner.dll"
"/r:/home/rupert/Development/LibSedML/3rdParty/CompareData.dll"
"/r:/home/rupert/Development/LibSedML/3rdParty/LibRoadRunner.dll"
"/r:/home/rupert/Development/LibSedML/3rdParty/LibStructuralCSharp.dll"
"/r:System.dll" "/r:System.Data.dll" "/r:System.Drawing.dll"
"/r:System.Windows.Forms.dll" "/r:System.Xml.dll"
"/r:/home/rupert/Development/LibSedML/3rdParty/ZedGraph.dll"
"/r:/home/rupert/Development/LibSedML/bin/libSedML.dll" /nologo
/warn:4 /optimize+ /codepage:utf8 /platform:x86 "/define:TRACE"
/t:library
"/home/rupert/Development/LibSedML/libSedMLRunner/SedMLRunner.cs"
"/home/rupert/Development/LibSedML/libSedMLRunner/Properties/AssemblyIn
fo.cs" "/home/rupert/Development/LibSedML/libSedMLRunner/RunResult.cs"
"/home/rupert/Development/LibSedML/libSedMLRunner/SimpleRunner.cs"
Build complete -- 0 errors, 0 warnings
Building: SedMLConsole (Release)
Performing main compilation...
Compiling resource
/home/rupert/Development/LibSedML/SedMLConsole/Properties/Resources.res
x with /usr/bin/resgen2
/usr/bin/gmcs /noconfig
"/out:/home/rupert/Development/LibSedML/bin/SedMLConsole.exe"
"/r:/home/rupert/Development/LibSedML/3rdParty/CompareData.dll"
"/r:System.dll" "/r:System.Drawing.dll"
"/r:System.EnterpriseServices.dll" "/r:System.Web.Services.dll"
"/r:System.Windows.Forms.dll" "/r:System.Data.dll" "/r:System.Xml.dll"
"/r:/home/rupert/Development/LibSedML/3rdParty/ZedGraph.dll"
"/r:/home/rupert/Development/LibSedML/bin/libSedMLRunner.dll"
"/r:/home/rupert/Development/LibSedML/bin/libSedML.dll" /nologo
/warn:4 /optimize+
"/win32icon:/home/rupert/Development/LibSedML/SedMLConsole/ICON_MIASE.i
co" /codepage:utf8 /platform:x86 "/define:TRACE" /t:winexe
"/home/rupert/Development/LibSedML/SedMLConsole/Program.cs"
"/home/rupert/Development/LibSedML/SedMLConsole/Properties/AssemblyInfo
.cs"
"/home/rupert/Development/LibSedML/SedMLConsole/Properties/Resources.De
signer.cs"
"/home/rupert/Development/LibSedML/SedMLConsole/Properties/Settings.Des
igner.cs" "/home/rupert/Development/LibSedML/SedMLConsole/Web
References/BioModels/Reference.cs"
"/home/rupert/Development/LibSedML/SedMLConsole/Web
References/MIRIAM/Reference.cs"
"/res:/home/rupert/Development/LibSedML/SedMLConsole/Properties/Resourc
es.resources,SedMLConsole.Properties.Resources.resources"
Compilation succeeded - 1 warning(s)

/home/rupert/Development/LibSedML/SedMLConsole/Program.cs(64,29):
warning CS0169: The private method
`SedMLConsole.Program.CreateSedMLProgramatically()' is never used


Build complete -- 0 errors, 1 warning
Building: libSedMLScript (Release)
Performing main compilation...
Compiling resource
/home/rupert/Development/LibSedML/libSedMLScript/Properties/Resources.r
esx with /usr/bin/resgen2
/usr/bin/gmcs /noconfig
"/out:/home/rupert/Development/LibSedML/bin/libSedMLScript.dll"
"/r:/home/rupert/Development/LibSedML/3rdParty/IronPython.dll"
"/r:/home/rupert/Development/LibSedML/3rdParty/Microsoft.Scripting.dll"

"/r:/home/rupert/Development/LibSedML/3rdParty/Microsoft.Scripting.Core
.dll" "/r:System.dll" "/r:System.Core.dll" "/r:System.Xml.Linq.dll"
"/r:System.Data.DataSetExtensions.dll" "/r:System.Data.dll"
"/r:System.Xml.dll"
"/r:/home/rupert/Development/LibSedML/bin/libSedML.dll" /nologo
/warn:4 /optimize+ /codepage:utf8 "/define:TRACE" /t:library
"/home/rupert/Development/LibSedML/libSedMLScript/ITextExporter.cs"
"/home/rupert/Development/LibSedML/libSedMLScript/ITextImporter.cs"
"/home/rupert/Development/LibSedML/libSedMLScript/Properties/Resources.
Designer.cs"
"/home/rupert/Development/LibSedML/libSedMLScript/SedMLPythonConverter.
cs" "/home/rupert/Development/LibSedML/libSedMLScript/SedMLScript.cs"
"/home/rupert/Development/LibSedML/libSedMLScript/Properties/AssemblyIn
fo.cs"
"/res:/home/rupert/Development/LibSedML/libSedMLScript/Properties/Resou
rces.resources,libSedMLScript.Properties.Resources.resources"
Build complete -- 0 errors, 0 warnings
Building: SedMLScriptTest (Release)
Performing main compilation...
WARNING: Assembly 'System.Deployment' not found. Make sure that the
assembly exists in disk. If the reference is required to build the
project you may get compilation errors.
Compiling resource
/home/rupert/Development/LibSedML/SedMLScript/MainForm.resx with
/usr/bin/resgen2
Compiling resource
/home/rupert/Development/LibSedML/SedMLScript/Properties/Resources.resx
with /usr/bin/resgen2
/usr/bin/gmcs /noconfig
"/out:/home/rupert/Development/LibSedML/bin/SedMLScriptTest.exe"
"/r:System.dll" "/r:System.Core.dll" "/r:System.Xml.Linq.dll"
"/r:System.Data.DataSetExtensions.dll" "/r:System.Data.dll"
"/r:System.Drawing.dll" "/r:System.Windows.Forms.dll"
"/r:System.Xml.dll"
"/r:/home/rupert/Development/LibSedML/bin/libSedMLRunner.dll"
"/r:/home/rupert/Development/LibSedML/bin/libSedMLScript.dll"
"/r:/home/rupert/Development/LibSedML/bin/libSedML.dll" /nologo
/warn:4 /optimize+
"/win32icon:/home/rupert/Development/LibSedML/SedMLScript/ICON_MIASE.ic
o" /codepage:utf8 /platform:x86 "/define:TRACE"
/main:SedMLScriptTest.Program /t:winexe
"/home/rupert/Development/LibSedML/SedMLScript/MainForm.cs"
"/home/rupert/Development/LibSedML/SedMLScript/MainForm.Designer.cs"
"/home/rupert/Development/LibSedML/SedMLScript/Program.cs"
"/home/rupert/Development/LibSedML/SedMLScript/Properties/AssemblyInfo.
cs"
"/res:/home/rupert/Development/LibSedML/SedMLScript/MainForm.resources,
SedMLScriptTest.MainForm.resources"
"/res:/home/rupert/Development/LibSedML/SedMLScript/Properties/Resource
s.resources,SedMLScriptTest.Properties.Resources.resources"
"/home/rupert/Development/LibSedML/SedMLScript/Properties/Resources.Des
igner.cs"
"/home/rupert/Development/LibSedML/SedMLScript/Properties/Settings.Desi
gner.cs"
Build complete -- 0 errors, 1 warning
Building: SedMLWeb (Release)
Generating CodeBehind members...
Waiting for project type database to finish updating...
Object reference not set to an instance of an object
rupert@linux:~/Development/LibSedML> cd bin
rupert@linux:~/Development/LibSedML/bin> ls
CompareData.dll Microsoft.Dynamic.dll
ICSharpCode.SharpZipLib.dll Microsoft.Scripting.Core.dll
IronPython.dll Microsoft.Scripting.Debugging.dll
LibRoadRunner.dll Microsoft.Scripting.dll
libsbmlcsP.dll Microsoft.Scripting.ExtensionAttribute.dll
libSedML.dll SBMLSupport.dll
libSedMLRunner.dll SBWCSharp.dll
libSedMLScript.dll SedMLConsole.exe
LibStructuralCSharp.dll SedMLScriptTest.exe
mathLibrary.dll ZedGraph.dll
rupert@linux:~/Development/LibSedML/bin> cp ~/Development/sbwbuild/cvs-dl/libsbml/src/bindings/csharp/libsbmlcs* .
rupert@linux:~/Development/LibSedML/bin> ls
CompareData.dll mathLibrary.dll
ICSharpCode.SharpZipLib.dll Microsoft.Dynamic.dll
IronPython.dll Microsoft.Scripting.Core.dll
LibRoadRunner.dll Microsoft.Scripting.Debugging.dll
libsbmlcs.la Microsoft.Scripting.dll
libsbmlcsP.dll Microsoft.Scripting.ExtensionAttribute.dll
libsbmlcs.snk SBMLSupport.dll
libsbmlcs.so SBWCSharp.dll
libSedML.dll SedMLConsole.exe
libSedMLRunner.dll SedMLScriptTest.exe
libSedMLScript.dll ZedGraph.dll
LibStructuralCSharp.dll
rupert@linux:~/Development/LibSedML/bin> cp ~/SBW-2.7.10/CSharp/libcvode*.so .
rupert@linux:~/Development/LibSedML/bin> cp ~/SBW-2.7.10/CSharp/libNleqLib.so .
rupert@linux:~/Development/LibSedML/bin> cp ~/SBW-2.7.10/CSharp/lib
libblas.so libcvode.so libLibLA.so
libblas.so.3 libg2c.so libLibStructural.so
libblas.so.3.0 libg2c.so.0 libNleqLib.so
libblas.so.3.0.3 libg2c.so.0.0.0 libsbl2SBML.dll
libbz2.so liblapack.so libsbmlcsP.dll
libbz2.so.1 liblapack.so.3 libsbmlcs.so
libbz2.so.1.0.2 liblapack.so.3.0 libsbml.so
libcvodedll.so liblapack.so.3.0.3 libSBW.so
rupert@linux:~/Development/LibSedML/bin> cp ~/SBW-2.7.10/CSharp/libLib*.so .
rupert@linux:~/Development/LibSedML/bin> ls
CompareData.dll libSedMLRunner.dll
ICSharpCode.SharpZipLib.dll libSedMLScript.dll
IronPython.dll LibStructuralCSharp.dll
libcvodedll.so mathLibrary.dll
libcvode.so Microsoft.Dynamic.dll
libLibLA.so Microsoft.Scripting.Core.dll
libLibStructural.so Microsoft.Scripting.Debugging.dll
libNleqLib.so Microsoft.Scripting.dll
LibRoadRunner.dll Microsoft.Scripting.ExtensionAttribute.dll
libsbmlcs.la SBMLSupport.dll
libsbmlcsP.dll SBWCSharp.dll
libsbmlcs.snk SedMLConsole.exe
libsbmlcs.so SedMLScriptTest.exe
libSedML.dll ZedGraph.dll
rupert@linux:~/Development/LibSedML/bin> mono ./SedMLConsole.exe ../Samples/lorenz.miase


The Results



This will result in the Lorenz Attractor simulated, and you should see:






Screen shot 2010-03-08 at 7.10.19 PM



I hope this gave a little over view in how to compile the library at this stage. I’ve archived the resulting binary and uploaded it to SF:



http://sourceforge.net/projects/libsedml/files/test

Nested Simulation Experiments

A couple of days ago, I posted a proposal for a Nested Simulation Experiment for SED-ML. There I proposed that instead of defining a new Simulation class for each experiment you’d like to run, it would be better for implementers and modelers alike to be able to compose simulation experiments out of primitives. That is instead of defining:

  • a TimeCourse Simulation experiment like this:

    <timeCourse id="s1" name="time course definition" algorithm="KiSAO:0000019">
    <uniformRange start="0" end="100" numberOfPoints="10" />
    </timeCourse>
  • and next like this:

    <timeCourse id="s1" name="time course definition" algorithm="KiSAO:0000019">
    <vectorRange>
    <value> 1 </value>
    <value> 4 </value>
    <value> 10 </value>
    <value> 23 </value>
    <value> 42 </value>
    </vectorRange>
    </timeCourse>

one could compose these same experiments with primitives. (Just as an aside, note that in the cases above a simulator supporting the simulation experiment would have to implement a different set of operations).

The Primitives

I would envision three primitives:

  • OneStep: this calculates one further output step for the model from its current state. Note that this does NOT have to mean one integration step. The simulator is allowed to take as many steps as needed, all that has to be fulfilled with this simulation class, is that, at the end, the desired output time is reached.
  • SteadyState: This brings the model from its current state to a steady state. This simulation class will also just provide one output row for attached data generators, the state of the model at steady state.
  • SetValue: This is not a simulation class, but rather a convenience function, to change a model variable/parameter. In this way it is akin to ChangeMath / ChangeAttribute / ChangeXML we would have to discuss the actual syntax of it.

These primitives then are used in a nested simulation experiment to describe virtually any simulation experiment. Through the nested class construct. This construct allows to refer to:

  • A task object, which defines the model and simulation experiment to be called repeatedly,
  • A range object, which defines how often the simulation task above is to be called,
  • A SetValue construct describing how model variables are to be changed. Note:that the SetValue construct will have to be able to refer to the ranges current value.

Additionally, flags would indicate, whether the model is supposed to be reset after each run or not.

Examples

So far the proposal, so how would this look in an example. Lets go through each one and make up some examples as we go along.

  • OneStep: This is a simulation class, causing the model time variable to be adapted from the current time with a given step (that determines where the desired output point is):

    <listOfSimulations>
    <oneStep id="s1" algorithm="KiSAO:0000019" step="0.1"/>
    </listOfSimulations>

    when used in a task, this simulation task simulates the model from 0 to 0.1. The data generators are supposed to be calculated to yield the desired outputs for time point 0.1.
  • SteadyState: This is another simulation class, so we would define it as such. Unfortunately KISAO does not currently describe any steady state solvers and instead mostly integrators. So suppose in the following that:

    KISAO:0000099 = steady state solver (it would probably somewhere below KISAO:0000018)

    <listOfSimulations>
    <steadyState id="s2" algorithm="KiSAO:0000099" />
    </listOfSimulations>

    when used in a task, this simulation task brings the model to steady state. Once finished the data generators are supposed to be calculated to yield the desired output points for the model variables at steady state.
  • NestedSimulation: So how would this now look in a nested simulation experiment:
  • <listOfSimulations>
        <nestedSimulation id="s3" algorithm="KiSAO:0000019"
                             resetModel="false" originalTask="task1">
        <vectorRange>
             <value> 1 </value>
            <value> 4 </value>
            <value> 10 </value>
        </vectorRange>
        <setValue target="/sbml/model/listOfParameters/parameter[@id='w']">
         <listOfVariables>
             <variable id="current" name="current range value" target="#current" />
         <listOfVariables/>
         <math>
             <ci>current</ci>
         </math>
        </setValue>
       </nestedSimulation>
    </listOfSimulations>

    The nested simulation above, would carry out task1 3 times. Each time the value of a model parameter ‘w’ is varied by applying one of the three values.  If task1 specifies a steady state primitive, then this snippet produces the steady state values for w=1, w=4 and w=10.

    Or we could have used a uniform range to sweep the parameter. Or a functional range, to vary the parameter in logScale for example.

    If task1 would refer to a uniformTimeCourse Simulation then this would actually perform a simulation, where a parameter is changed in steps. After each time we would see how the model reacts to this discrete parameter change.

Note that you could even define a uniform time course simulation using this approach. Here task1 refers to a ‘oneStep’ simulation task. We would just vary the models time each time:

<listOfSimulations>
    <nestedSimulation id="s3" algorithm="KiSAO:0000019"
                         resetModel="false" originalTask="task1">
    <uniformRange start="0" end="100" numberOfPoints="10" />
    <setValue target="#time">
     <listOfVariables>
         <variable id="current" name="current range value" target="#current" />
     <listOfVariables/>
     <math>
         <ci>current</ci>
     </math>
    </setValue>
   </nestedSimulation>
</listOfSimulations>

You could even think about nesting the nestedSimulation experiments in order to for example perform 2D parameter scans or what have you.

Conclusions

Defining simulation experiments through these primitives will open up SED-ML and make it really useful. These primitives are easy to implement. In fact they are already implemented in available simulators. They are what is needed to implement the proposed Range construct anyway.

So let us not be shackled by having to each time define a new simulation class. The nested approach here will be what is needed to define most simulation experiments. By adding new primitives later on it can be easily extended.

I’m perfectly happy to open it up further. What one could envision would be multiple <setValue> elements to change multiple parameters. or even multiple ranges, though then each would have to have an id, to be used in the SetValue constructs. But I’m sure it could be sorted out.

Wednesday, March 3, 2010

Supporting SED-ML

SED-ML, the Simulation Experiment Description – Markup Language, offers the possibility to exchange simulation experiments. That is, instead of receiving a model and wondering how you can make it do what it is supposed to do, you would simply run the accompanying SED-ML document and see the figures reproduced.

SimulationTool

As with any new standards initiative, it will only be taken up if there are computational resources, that make it easy to use, and of course if the standard can be helpful. Currently, with SED-ML in a very early stage it is already possible to exchange time course simulation experiments, but not much more. However, it could be extended easily, such as by using a Nested Simulation Experiment, as described at the link below.

But what about computational resources? As it so happens, I’ve created a new project:

LibSedML - libsedml.sourceforge.net/ 

There, I provide three libraries:

  • LibSedML – a .NET library for reading and writing SED-ML
  • LibSedMLRunner  – a library on top of LibSedML, that schedules and runs simulation experiments.
  • LibSedMLScript – a utility library, turning a human readable script format into SED-ML.

Three applications support these libraries so far:

  • SED-ML Script: This application provides an easy way to define new Simulation Experiments using the human readable script format. No more struggling with API calls or XML, a simple script defines a simulation experiment. It can also be readily tested right then and there.
    multipleplots
  • A web application provides the same functionality and provides a test bed, without having to download any software.
  • A plug-in for the SBW Simulation Tool, allows to run SED-ML files directly from it and provides capabilities for saving simple simulation experiments. (screenshot at beginning of this post)

The libraries and tools have been implemented using .NET, and have been confirmed to run fine on Windows, Linux and OS X!

 

Bergmann, Frank. A Simple Nested Simulation for SED-ML. Available from Nature Precedings <http://dx.doi.org/10.1038/npre.2010.4257.1> (2010)