Including volume programmatically with unknown kinetic laws:

Daniel Bending on 16 Aug 2023 (Edited on 16 Aug 2023)
Latest activity Reply by Jeremy Huard on 21 Aug 2023

Hi all,
I've translated a model from another piece of software (monolix) into simbio programmatically to make use of your very easy global sensitivity analysis system.
It looks a little something like this, for a 'single' line example:
r1 = addreaction(model,'InsI -> InsP');
r1.ReactionRate = 'InsI*kip/vi'; %- is + panc
k1 = addkineticlaw(r1, 'Unknown');
Multiplied about 20 fold, as you can see I have included my volumes within the reaction rates myself (vi). The model functions perfectly and I have corrected the outputs at the end:
[time, x, names] = sbiosimulate(model,csObj,dObj1);
x(:,1) = x(:,1)/vi;
So that they are in concentration, as needed. However, when it comes to sensitivity analysis because I have corrected them post-model it is technically incorrect, it is analysing the absolute quantities. This is quite noticible in the sensitivity to the volumes.
Is there an easy fix to this, I've had to fight dimensionality with units in the past using simbio and I'd be great if there was some way of dividing a compartment output by a volume, for example. It is a functionality that exists in monolix, so I was hopeful it might here!
Thank you for your time.
EDIT:
I think I've worked it out, I had to refactor my model to operate in concentrations, just refitting it now. Now I should just be able to use unitless compartments.
Jeremy Huard
Jeremy Huard on 16 Aug 2023 (Edited on 16 Aug 2023)
It is fine in SimBiology to have species in units of concentration and others in units of amount.
SimBiology will take care of volume scaling whenever needed and will give you back the results in the units you have chosen.
So, in your case you can use a MassAction kinetic law without issue:
r1 = addreaction(model,'InsI -> InsP');
k1 = r1.addkineticlaw('MassAction');
k1.ParameterVariableNames = {'kip'};
model.getequations() % to visualize the ODEs with volume scaling
But make sure that Dimensional Analysis and Unit Conversion are activated:
csObj.CompileOptions.UnitConversion = true;
Please note that turning on Unit Coinversion will automatically activate Dimensional Analysis.
Finally, in cases where you need an output in a different unit as the one used in the model, you can define an Observable with the requested unit. Observables are parts of the model and can be used as outputs of a Global Sensitivity Analysis.
Best,
Jérémy
Daniel Bending
Daniel Bending on 17 Aug 2023
Hello Jérémy,
Good to hear from you (I've still got the hat..!), I hope you're well. That all makes complete sense, defining the observable is probably the easiest way of doing it, I hadn't run across that yet, very useful to know.
Thank you for the reply!
Jeremy Huard
Jeremy Huard on 21 Aug 2023
Hi Daniel,
I am glad you like the hat! I hope all is well with you too.
It is good to hear that Observables solve your issue. In general I would like to recommend you to always activate unit conversion to make sure that SimBiology takes them into account in your reactions but also in rules and observable definitions.
All the best!
Jérémy