Getting and setting reaction parameters and reactions

[1]:
import sys
sys.path.append('../..')
%matplotlib inline
[2]:
from basico import *

Load model

[3]:
biomod = load_example("LM-test1")

Getting/setting global quantities

It is possible to set:
    'initial_value'
    'initial_expression'
    'expression'
    'status'
    'type'
[4]:
get_parameters()
[4]:
type unit initial_value initial_expression expression value rate key
name
epsilon fixed 0.78 NaN 0.0 ModelValue_0
offset fixed 0.10 NaN 0.0 ModelValue_1
signal assignment 0.10 [P] * Values[epsilon] + Values[offset] NaN NaN ModelValue_2
[5]:
set_parameters(name= 'offset', initial_value = 50)
[6]:
set_parameters('signal', expression='[P] * Values[epsilon] + Values[offset]')
[7]:
get_parameters()
[7]:
type unit initial_value initial_expression expression value rate key
name
epsilon fixed 0.78 NaN 0.0 ModelValue_0
offset fixed 50.00 NaN 0.0 ModelValue_1
signal assignment 50.00 [P] * Values[epsilon] + Values[offset] NaN NaN ModelValue_2

Getting/setting species (metabolites)

[8]:
get_species()
[8]:
compartment type unit initial_concentration initial_particle_number initial_expression expression concentration particle_number rate particle_number_rate key
name
E compartment reactions mmol/ml 0.010000 6.022142e+18 NaN NaN NaN NaN Metabolite_1
S compartment reactions mmol/ml 10.000001 6.022142e+21 NaN NaN NaN NaN Metabolite_0
ES compartment reactions mmol/ml 0.000000 0.000000e+00 NaN NaN NaN NaN Metabolite_2
P compartment reactions mmol/ml 0.000000 0.000000e+00 NaN NaN NaN NaN Metabolite_3
[9]:
get_species(name = 'E')['initial_concentration']
[9]:
name
E     0.01
ES    0.00
Name: initial_concentration, dtype: float64

Setting

if 'name' in kwargs:
    metab.setObjectName(kwargs['name'])

if 'unit' in kwargs:
    metab.setUnitExpression(kwargs['unit'])

if 'initial_concentration' in kwargs:
    metab.setInitialConcentration(kwargs['initial_concentration']),

if 'initial_particle_number' in kwargs:
    metab.setInitialValue(kwargs['initial_particle_number']),

if 'initial_expression' in kwargs:
    metab.setInitialExpression(kwargs['initial_expression'])

if 'expression' in kwargs:
    metab.setExpression(kwargs['expression'])
[10]:
set_species(name = 'E', new_name = 'Lilija')
[11]:
set_species(name = 'Lilija', initial_concentration = 123456)
[12]:
get_species(name = 'Lilija')
[12]:
compartment type unit initial_concentration initial_particle_number initial_expression expression concentration particle_number rate particle_number_rate key
name
Lilija compartment reactions mmol/ml 123456.0 7.434694e+25 NaN NaN NaN NaN Metabolite_1
[13]:
# change it back
set_species(new_name = 'E', name = 'Lilija')

Getting/setting reaction parameters

[14]:
get_reaction_parameters()
[14]:
value reaction type mapped_to
name
(R1).k1 130.0 R1 local
(R1).k2 1.0 R1 local
(R2).k1 1.0 R2 local
Setting only the following is possible:
'new_name'
'value'
[15]:
set_reaction_parameters(name = '(R1).k1', value=123)
[16]:
get_reaction_parameters()
[16]:
value reaction type mapped_to
name
(R1).k1 123.0 R1 local
(R1).k2 1.0 R1 local
(R2).k1 1.0 R2 local

Getting/setting reactions

[17]:
get_reactions()
[17]:
scheme flux particle_flux function
name
R1 S + E = ES NaN NaN Mass action (reversible)
R2 ES -> E + P NaN NaN Mass action (irreversible)

Setting scheme

[18]:
set_reaction(name = 'R1', scheme = 'S + E + F = ES')
[19]:
get_reactions()
[19]:
scheme flux particle_flux function
name
R1 S + E + F = ES NaN NaN Mass action (reversible)
R2 ES -> E + P NaN NaN Mass action (irreversible)

Setting reaction name

[20]:
set_reaction(name = 'R1', new_name = 'Reaction 1')
[21]:
get_reactions()
[21]:
scheme flux particle_flux function
name
Reaction 1 S + E + F = ES NaN NaN Mass action (reversible)
R2 ES -> E + P NaN NaN Mass action (irreversible)
[ ]: