Download Links

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

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.