Code covered by the BSD License  

Highlights from
get reaction rates out of SimBiology

5.0

5.0 | 2 ratings Rate this file 7 Downloads (last 30 days) File Size: 2.4 KB File ID: #32961
image thumbnail

get reaction rates out of SimBiology

by

 

This tool pulls the reaction rates out of your SimBiology model.

| Watch this File

File Information
Description

Unfortunately, SimBiology does not give you the rates of your reactions at all. However, in order to run, SimBiology does calculate the rates. rateout.m records all rates while you're simulating.

This little tool needs to be incorporated as two simple rules in your model (the first as initialAssignment, the second as rate).

temp = rateout(-1)
temp = rateout(time)

This way the model saves the rates for all reactions in each simulation step in a global variable. Calling rateout.m from your workspace sorts through the intermediates and assigns all rates in your workspace (next to t and x, which SimBiology puts there anyway).

Detailed instructions are in the file itself.

Required Products SimBiology
MATLAB release MATLAB 7.13 (R2011b)
Other requirements You need to bring your own SimBiology model.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
29 Aug 2013 Aditya

Thank you Timothy.

22 Feb 2013 Timothy Shih

Hello,

For anyone trying to use this function in 2012b, you might have encountered an error while doing so. This is because the internal MATLAB code has changed so that the velocities are stored in a different variable name, so trying to retrieve them will fail and you end up with an empty velocity and time matrix.

Thus, replace the line
v(:,end+1) = evalin('caller', 'v');

with the line
v(:,end+1) = evalin('caller', 'reactionFlux');

This will resolve the error. However, I am assuming that the changes in the internal simulation code won't change the results. Please exercise caution, and double check your results carefully.

-Timothy

19 Feb 2013 Aditya  
23 Sep 2011 Frank Sommerhage

Thank you Arthur.

I noticed some differences between the units - in my case, multiplying with a plain 50 did the trick. However, other users might have to use another scaling factor. My next upload will contain a reminder for the scaling factor.

Also, I will incorporate the version check you recommended - just in case.

The ODE trials were mostly filtered out by taking always the last calculated value per time step. This is not 100% save for good results, but hopefully the best choice so far.

My hopes are still on you and your team to incorporate a more efficient way for rate exports directly into SimBiology.

Thanks again,
Frank

23 Sep 2011 Arthur Goldsipe

I'm a member of the SimBiology team, and it's very exciting to see our users coming up with creative solutions for features that we haven't yet implemented. Thanks, Frank!

I'd like to prevent any problems for people using this function, so here are a few caveats:

It is relying on some undocumented details of SimBiology that may change between releases. Perhaps you could add a version check when calling rateout(-1), just to warn users if the version is an untested one?

Since this function records reaction rates every time it is called, it may also record trial values that the ODE solver rejects because they have too much error.

Be careful interpreting the dimensions and units of the recorded reaction rates. They may not be what you expect, especially if you are using UnitConversion. Currently, reaction rates are always in dimensions of amount/time. The units used internally for amount and time will depend on the model.

-Arthur

Contact us