RoadRunner support a wide range of options for selecting SBML and derivative values. Selections can be used to either retrive or in many cases, store values. We define SBML values as any element specified in the original SBML doucment, whereas derivative values are a function of one or more SBML values. As these functions typically have no inverse, these are read only selections.
Selections are used a number of RoadRunner methods. They are used to determine what columns are selected in a simulation result and can also be used to directly select model values.
The selection syntax is case sensitive (SBML elements are case sensitive), however it ignores all white space.
Selection Types:
One my try individual selection string using the RoadRunner.getSelectionValue() method. This takes a selection string, determines if it is valid, and returns the value it selects. For example:
>>> rr.getSelectionValue("cc(S1, J4_KS4)")
-0.42955738179207886
Even though they are almost always specified by a string, RoadRunner selections are actually object. One can create a selection object directly using RoadRunner.createSelection(), and in order to see extended information about, simply display it. For example, using ipython:
>>> sel = rr.createSelection("cc(S1, J4_KS4)")
>>> sel
SelectionRecord({'index' : -1, 'p1' : 'S1', 'p2' : 'J4_KS4', 'selectionType' : CONTROL})
We can see that this is a CONTROL record.
It is also possible to modify the simulation selection list by deleting existing items and adding new once created with RoadRunner.createSelection(). If someone has does not want to display the concentration of species S2 and instead wants to display the rate of change of species S:
>>> rr.selections
["time", "[S1]", "[S2]", "[S3]", "[S4]"]
>>> sel = rr.createSelection("S1'")
>>> rr.selections[2] = sel
>>> rr.selections
["time", "[S1]", "S1'", "[S3]", "[S4]"]
Even though the selection list intentionally appears as a list of string, it is actually a list of selection objects. So, elements that are inserted or appended to this list must be selection objects created by RoadRunner.createSelection().
The colums of the RoadRunner simulation result are determined by selections, these are accessed by the RoadRunner.selections property. This is a list of what values will be displayed in the result, and can be set simply by:
rr.selections = ['time', '[S1]', 'S1', "S1'"]
This example selects the columns time, concentration of S1, amount of S1 and rate of change of S1. One may also have derivative values in the simulation selection, for example, if one wanted to plot the elasticity of a particular reaction:
rr.selections = ['time', '[S1]', "ee(J1, P1)"]
ExecutableModel[] | |
ExecutableModel.__setitem__(*args) |