Download Links

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

Tuesday, January 19, 2010

RoadRunner and the new test suite

Yesterday the SBML team announced a new release of test data for the SBML Test suite. So of course I had to check how roadRunner fares in it.  A re-run of the test suite with only SBML Algebraic Rules and the ‘fast’ flag disabled gives the expected result of:

2010-01-19_-_TestSuiteResults 

All green! Just as it was meant to be. I really should make a new release of SBW soon! Lots of new things up and coming the highlights for roadRunner will include acronyms like SED-ML and SBRML …

Stay tuned!

Saturday, November 14, 2009

Matlab Export Anyone?

SBW for a long time had facilities for exporting SBML models to Matlab and a slew of other formats. I have to admit I never really used the Matlab Export before, and so it came as a surprise when I heard that the export of SBML Assignment rules was broken. But good news, at least this export is now working just fine.

SBW Logo (short)-transparentSo let us look at some examples on how we would use it. For this let us construct a very simple model, a 3 step linear chain:

linear_chain

Here we set Node0 and Node2 to be a Boundary (fixed) Species, as they are not really part of the system. And we want Node0 to be controlled by an Assignment Rule, which sets the value of Node0 to ‘5’ starting at 1 second for 2 seconds. Outside this window Node0 should be close to zero (and I say close to zero and not zero so that the integrators will pick up the change). So this translates into a piecewise function:

Node0 = 5 if 1 < time < 3 and 0.1 otherwise

in SBML infix speak this translates into:

Node0 = piecewise(5, and(geq(time,1), leq(time, 3)), 0.1)

here of course piecewise, stands for the piecewise operation, note that you can have as many pieces as you’d want … for every piece you would add two terms, the value and a Boolean expression. The Boolean expressions supported are:

Name

Argument type

Explanation

and n-ary n-ary and like in the example above, it is 1iff all arguments are 1
xor n-ary n-ary xor, is 1 iff not all arguments are 1 or all arguments are 0
or n-ary n-ary or, is 1 if at least one of the arguments is 1
not unary is 1 if argument is 0 and 0 otherwise
gt(a,b) binary greater: is 1 if a > b
lt(a,b) binary less than: is 1 if a < b
geq(a,b) binary greater or equal: is 1 if a >= b
leq(a,b) binary less or equal: is 1 if a <= b
eq(a,b) binary equal: is 1 iff a == b
neq(a,b) binary not equal: is 1 iff a != b
piecewise( value, condition, otheriwse) n-ary piecewise function: each piece is defined with a value, condition pair and concluded with an value for the otherwise clause. all values and conditions can of course be function expressions as well.  

So let us look at the complete model in the JarnacLite language (this will allow you to just paste it into JarnacLite without you having to download the SBML model):

p = defn AsssignmentExport

var Node1;
ext Node0,Node2;

J0: Node0 -> Node1; J0_k*Node0;
J1: Node1 -> Node2; J1_k*Node1;

Node0 = piecewise(5, and(geq(time,1), leq(time, 3)), 0.1);

end;

p.Node0 = 0;
p.Node1 = 0;
p.Node2 = 0;
p.J0_k = 0.1;
p.J1_k = 0.1;

When in JarnacLite, a click on SBW\Translate SBML –> Any will bring up the SBML Translators, and a click on the Matlab tab shows you the newly translated model:

image

As you can see this model is complete with instructions on how to use it in Matlab. And here the good news it works in Octave as well! (you’d just download ode23.m and put it in the same directory and you should be good to go!) So all that is left is to save the file as .. say … AsssignmentExport.m into your Matlab work directory and run:

x0 = AsssignmentExport
[t, x] = ode23s(@AssignmentExport, [0 20], AssignmentExport);
plot(t,x);

and you should see a graph like this:

image

And here the disclaimer, I do know that you’d normally implement these sort of things as SBML Events, but so far we don’t export SBML events to Matlab, but you can always use roadRunner to have them simulated correctly.

So if you want to give this new version of the Matlab export a try, download a new Installer, or select Systems Biology Workbench\Utilities\Update SBW from an existing SBW installation. 

Friday, November 6, 2009

Changing Initial Concentrations the easy way

It’s been some time since I updated the SBW Simulation Tool, just to jog the Memory the SBW Simulation Tool, is the application, that will interact with all SBW enabled Simulators and makes it a snap to perform simulation experiments (be it time course simulations, steady state computations, pulse or scan experiments or even Frequency Analysis). Especially neat, if you ask me, is the Options\Slider feature, which basically attaches a handle to all parameters / boundary conditions of a model and allows you to quickly modify the current value and see what effect it has on the simulation you were performing.

image

Changing parameters and boundary conditions was great, but what about initial concentrations of all the floating species. Of course that is an operation that should have been there in the first place, and so *drum roll* here finally a version that makes it a snap to modify those values as well. So lets try it, lets take a simple bi-stable model like this one:

p = defn Bistable

var S1, S2;

$X0 => S1; k1*(1+x)/(1+k2*pow(S2,2));
$X0 => S2; k3/(1+k4*pow(S1,2));

S1 => $X0; k0*S1;
S2 => $X0; k0*S2;

end;
// initialize Parameters
p.k1 = 1; p.k2 = 1; p.k3 = 1; p.k4 = 1; p.k0 = 0.1;

// and initial conditions
p.S1 = 5; p.S2 = 5;

You’d paste the model above simply into JarnacLite and then click SBW\Simulation Tool: RoadRunner to get it into the simulator. And then select Options\Sliders … and now if you vary the initial conditions of S2 you see how the behavior changes … amazing, isn’t it?

Here the result for S1 = 4

image

and S1 = 6

image

Neat … just as an aside … remember to check the “Fix Y Axis” Checkbox! otherwise the experience is limited, as the graph will scroll the whole time to adapt to the values.

Monday, November 2, 2009

Systems Biology Workbench / Linux made easy

I’m just back from the monospace event, which by the way was really amazing. In his keynote Miguel presented SUSE studio, which makes it very easy to put together a Linux live cd, VMware image or USB images with your favorite Linux app.

testdrive-networking

Given the huge number of support requests I received for the SBW Linux versions, i thought it would make a good test case to put together a live CD for the last SBW version. Here the download links:

The Linux distribution is openSUSE (11.1) and automatic login is set up for user ‘sbw’ with password ‘linux’ which is also the admin password.

And here a screen cast of what the experience is like (For this i just downloaded the VMware Image above, extracted the archive (using for example WinRAR) and next started the VMware Image using VMware Workstation (a free VMware player is also available)):

Now admittedly, this is not yet working as smoothly as possible, I will polish the build process in time for the next SBW release and then all the remaining GUI glitches will be gone.

Monday, September 14, 2009

Debugging the Systems Biology Workbench

SBW Logo (short)-transparent Work on an SBW and JSim integration is in full progress. However the other day I came across a minor snag with the SBW Java bindings, for the life of me I couldn’t find out why we could not send a model from one application to another. On any other platform (OSX, Ubuntu, Windows), I would just have started the SBW Inspector, and called the methods from the UI, or I would have used PowerShell, or the CSharp interactive shell, or even IronPython to code against the SBW object model. However I was out of luck, I did not have the mono runtime available on that system. So it dawned to me that really there should be some sort of simple debugging tools available. Given that on the system the only thing I had available was Java, I went and wrote the simplest Java SBW modules to narrow down the process. I figured in case others have the same problem I might as well put them up here for grabs.

So how would you use those java classes:

  1. Download the SBWtest.tar.gz file
  2. Extract with: tar zxf SBWtest.tar.gz
  3. change to the directory: cd SBWtest

at this point you will find two jar files (SBWCore.jar and SBWCore-debug.jar). Those jar files are the SBW Java bindings. All the following commands will assume that you include them in your classpath. There are two jar files, the SBWCore.jar will silently do its work and SBWCore-debug.jar will work just the same but add tons of debugging information for when it is really needed. Usually you’d just use the SBWCore.jar, and only switch to the other one if something fishy is going on. Let us have a brief look at the java classes included in the archive:

ListModules This all this simple class does, is to connect to SBW, and get a list of registered modules and print them to stdout. Use with:

java –cp SBWCore.jar:. ListModules

This will print a list of module names, you will have the ‘unique’ module name, followed by an equals sign and then the human readable name.
ListRunningModules This class connects to SBW and lists all currently running SBW modules. Use with:

java –cp SBWCore.jar:. ListRunningModules
StartModule A simple java class, that will just start another SBW module, it expects one argument, the ‘unique’ name of an SBW module (the name before the equals sign in the ListModules output). Start with:

java –cp SBWCore.jar:. StartModule <moduleName>

for example:

java –cp SBWCore.jar:. StartModule edu.caltech.NOM

to start the SBML support module.
Analyzer The Analyzer class represents a simple SBW module by itself. It belongs to the ‘/Analysis’ category, and as such will when registered appear in the SBW module. It has one method, ‘void doAnalysis(string)’ which will take a string (usually an SBML model, when called through the SBW menu) and print it to the command line. As with all SBW modules, it takes one argument, either ‘-sbwmodule’ in which case it is launched as module, or ‘-sbwregister’ in which case it registers with the Broker (and it should be displayed with a call to ListModules as ‘testAnalyzer’). Use with:

java –cp SBWCore.jar:. Analyzer –sbwregister

to register, or with:

java –cp SBWCore.jar:. Analyzer –sbwmodule

to run it as module.
CallAnalyzer Finally there is CallAnalyzer, a simple class, that takes two arguments, the first is a ‘unique’ SBW module name (as given by ListModules) and the other is a fileName of a SBML file, which is read and passed to the SBW module. This basically mimics what will happen if an SBW analyzer is called from the SBW menu. Use with:

java –cp SBWCore.jar:. CallAnalyzer <moduleName> <fileName>

as in:

java –cp SBWCore.jar:. Analzer ~/SBML\ Models/BorisEJB.xml

I hope they will be useful for someone else … btw … turns out that the only thing that was not working as planned, was that the module in question was registered as SELF_MANAGED module instead of a UNIQUE one … so all is well with the bindings …

Wednesday, September 9, 2009

SBW FluxBalance Module – Step 2

Some time ago I’ve implemented a basic FluxBalance SBW Module. It never was that useful really, all one could do was to load an SBML file and to define a couple of constraints and objectives. So while Brett Olivier is visiting Seattle, we sat together and came up with a scheme to store this sort of Information. This resulted in the next version of the FluxBalance tool:

2009-09-09_-_FBA

This new version does not do much more than it did before, however now at least it stores the constraint and objective function in an SBML compliant annotation (which hopefully later on becomes an official SBML Level 3 package for flux balance analysis).

There is a new Windows Installer, that you can try right away …

Tuesday, September 8, 2009

RoadRunner and Events

Finally I’m back from this years ICSB. In discussions at the SBML Forum I noticed that the timing of events in roadRunner could be improved. RoadRunner is of course our high performance simulator, which is also available as web application on our home page. I’ve just finished the modifications on roadRunner and ran through the test suite again:

2009-09-08_-_TestSuite_-_NoAlgebraicNoFast

And while roadRunner still won’t support Algebraic Rules, the ‘fast’ flag on SBML Reactions or Delay Differential Equations, we now pass all other tests. (You might wonder about the isolated four points that in red scream that the event timing would be off. For full disclosure those are the test cases 408, 428, 684 and 849. In discussions with the COPASI team and Chris Myers from iBioSim it would seem that it is the test cases that are to blame.)

Windows users can get the new roadRunner installed from here, or by choosing “Systems Biology Workbench\Utilities\Update SBW” from the Start menu of an existing SBW 2.7.10 release. A new Linux and OSX release will be made later in the month, or early next month, when we hopefully have SBML Level 3.