8.1.1.2. skimpy.core

[———]

Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

8.1.1.2.1. Submodules

8.1.1.2.2. Attributes

QSSA

TQSSA

MCA

ODE

ELEMENTARY

Jacobian Types

NUMERICAL

SYMBOLIC

MCA Types

NET

SPLIT

Item types

PARAMETER

VARIABLE

Units

KCAL

KJ

JOULE

OTHER

WATER_FORMULA

QSSA

TQSSA

MCA

ODE

ELEMENTARY

Jacobian Types

NUMERICAL

SYMBOLIC

MCA Types

NET

SPLIT

Item types

PARAMETER

VARIABLE

Units

KCAL

KJ

JOULE

OTHER

WATER_FORMULA

8.1.1.2.3. Classes

KineticModel

This class contains the kinetic model as described by reaction and

KineticMechanism

Helper class that provides a standard way to create an ABC using

ExpressionModifier

This class describes a modifier to an expression, like a boundary condition

BoundaryCondition

We differentiate boundary conditions as modifiers that define the boundaries

ConstantConcentration

AdditiveConcentrationRate

Add a concentration rate term to your rate expression

BoundaryFlux

We differentiate boundary conditions as modifiers that define the boundaries

FirstOrderSmallMoleculeModifier

Helper class that provides a standard way to create an ABC using

DisplacementSmallMoleculeModifier

Helper class that provides a standard way to create an ABC using

ActivationModifier

Helper class that provides a standard way to create an ABC using

InhibitionModifier

Helper class that provides a standard way to create an ABC using

HillActivationModifier

Helper class that provides a standard way to create an ABC using

SimpleHillActivationModifier

Helper class that provides a standard way to create an ABC using

HillInhibitionModifier

Helper class that provides a standard way to create an ABC using

Reaction

Global reaction class

TabDict

Really just an ordered dict with tab completion in interactive terminals

Item

ItemSet

Helper class that provides a standard way to create an ABC using

Parameter

ParameterSet

Helper class that provides a standard way to create an ABC using

Reactant

ReactantSet

Helper class that provides a standard way to create an ABC using

TabDict

Really just an ordered dict with tab completion in interactive terminals

ParameterValues

Parameters set for kinetic models wich can be indexed with symbols or

ParameterValuePopulation

8.1.1.2.4. Functions

check_is_symbol(s_in)

make_parameter_set(mechanism, param_declaration)

make_reactant_set(mechanism, reactant_declaration)

make_parameter_set(mechanism, param_declaration)

make_reactant_set(mechanism, reactant_declaration)

load_parameter_population(filename[, lower_index, ...])

concat_populations(values[, kmodel, index])

8.1.1.2.5. Package Contents

class skimpy.KineticModel(reactions=None, boundary_conditions=None, constraints=None, name='Unnamed')

Bases: object

This class contains the kinetic model as described by reaction and boundary conditions and constratins.

:param : :return:

name = 'Unnamed'
reactions
boundary_conditions
constraints
initial_conditions
logger
_simtype = None
_modified = True
_recompiled = False
compartments
property reactants
property parameters
property moieties
add_reaction(reaction)

Adds a SKiMPy reaction to the model

Parameters:

reaction (skimpy.core.Reaction) – The reaction to add

Returns:

add_compartment(compartment)
Parameters:

compartment

Returns:

add_constraint(constraint)
add_boundary_condition(boundary_condition)

Enforces a boundary condition (e.g. a constant concentration) on the kinetic model

Parameters:

boundary_condition (skimpy.core.BoundaryCondition) – the boundary condition to enforce

Returns:

add_to_tabdict(element, kind)
parametrize_by_reaction(param_dict)
If has input: apply as dict to reactions in the model by

reaction.parametrize(args)

Returns:

parametrize(param_dict)
repair()

Link inhibitors and activators to reactants FIXME: Any idea to avoid this is dearly welcome :return:

property sim_type
prepare(mca=True, ode=True, **kwargs)

Model preparation for different analysis types. The preparation is done before the compiling step to be able to curate the model in between

Parameters:
  • mca

  • ode

Returns:

compile_jacobian(type=NUMERICAL, sim_type=QSSA, ncpu=1)
compile_ode(sim_type=QSSA, ncpu=1)
solve_ode(time_out, solver_type='cvode', **kwargs)

The solver types are from ::scikits.odes::, and can be found at <https://scikits-odes.readthedocs.io/en/latest/solvers.html>`_.

Parameters:
  • time_out (list(float) or similar) – The times at which the solution is evaluated

  • solver_type – must be among [‘cvode’,’ida’,’dopri5’,’dop853’]

  • kwargs

Returns:

compile_mca(parameter_list=[], mca_type=NET, sim_type=QSSA, ncpu=1)

Compile MCA expressions: elasticities, jacobian and control coeffcients

skimpy.check_is_symbol(s_in)
class skimpy.KineticMechanism(name, reactants, parameters=None, inhibitors=None, enzyme=None)

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

name
reactants
inhibitors = None
_parameters = None
enzyme = None
__reduce__()
property parameters
abstract property Reactants

Class to define metabolites and their roles in the reaction :return:

abstract property Parameters

Class to define parameters and their roles in the reaction :return:

abstract get_qssa_rate_expression()
abstract update_qssa_rate_expression()
abstract get_full_rate_expression()
abstract calculate_rate_constants()
get_parameters_from_expression(expr)
skimpy.make_parameter_set(mechanism, param_declaration)
skimpy.make_reactant_set(mechanism, reactant_declaration)
class skimpy.ExpressionModifier(name, reaction=None, modifier=None)

Bases: object

This class describes a modifier to an expression, like a boundary condition or constraint. For example, changing a rate to a constant (boundary condition), or linking it to another variable of the model (constraint). It accepts as an argument a modifier.

A modifier is a function which will look at all your expressions, and apply its transformation to them. As a result, its arguments have to be a TabDict of expressions, such as KinModel.ODEFun.expressions

prefix = 'MOD'
_name
_reaction = None
__call__(expressions)
property modifier

Link the modifier to a model, to gain awareness of the inner/outer variables :param model: :return:

property name
class skimpy.BoundaryCondition(name, modifier=None, reaction=None)

Bases: ExpressionModifier

We differentiate boundary conditions as modifiers that define the boundaries of the observed system.

prefix = 'BC'
class skimpy.ConstantConcentration(reactant, name=None, reaction=None)

Bases: BoundaryCondition

prefix = 'CC'
reactant
modifier(expressions)

Set the rate to 0 :param expressions: :return:

__del__()
class skimpy.AdditiveConcentrationRate(reactant, flux_value, name=None, reaction=None)

Bases: ExpressionModifier

Add a concentration rate term to your rate expression

prefix = 'ADDCR'
reactant
flux_value
modifier(expressions)

Add to the rate expression :param expressions: :return:

class skimpy.BoundaryFlux(reactant, flux_value, reaction=None)

Bases: BoundaryCondition, AdditiveConcentrationRate

We differentiate boundary conditions as modifiers that define the boundaries of the observed system.

prefix = 'BF'
check_dependency(expression)
class skimpy.FirstOrderSmallMoleculeModifier(small_molecule, mechanism_stoichiometry, name=None, reaction=None)

Bases: skimpy.mechanisms.mechanism.KineticMechanism, ExpressionModifier

Helper class that provides a standard way to create an ABC using inheritance.

prefix = 'HSM'
Reactants

Class to define metabolites and their roles in the reaction :return:

Parameters

Class to define parameters and their roles in the reaction :return:

modifier(expressions)

change the flux reaction rate expressions :param expression: {vnet, vfwd, vbwd} :return:

get_qssa_rate_expression()
update_qssa_rate_expression()
abstract get_full_rate_expression()
abstract calculate_rate_constants()
class skimpy.DisplacementSmallMoleculeModifier(small_molecule, mechanism_stoichiometry, name=None, reaction=None)

Bases: skimpy.mechanisms.mechanism.KineticMechanism, ExpressionModifier

Helper class that provides a standard way to create an ABC using inheritance.

prefix = 'DSM'
Reactants

Class to define metabolites and their roles in the reaction :return:

Parameters

Class to define parameters and their roles in the reaction :return:

modifier(expressions)

change the flux reaction rate expressions :param expression: {vnet, vfwd, vbwd} :return:

get_qssa_rate_expression()
update_qssa_rate_expression()
abstract get_full_rate_expression()
abstract calculate_rate_constants()
class skimpy.ActivationModifier(activator, name=None, k_activation=None, reaction=None)

Bases: skimpy.mechanisms.mechanism.KineticMechanism, ExpressionModifier

Helper class that provides a standard way to create an ABC using inheritance.

prefix = 'AM'
Reactants

Class to define metabolites and their roles in the reaction :return:

Parameters

Class to define parameters and their roles in the reaction :return:

reactant_stoichiometry
modifier(expressions)

change the flux reaction rate expressions :param expression: {vnet, vfwd, vbwd} :return:

get_qssa_rate_expression()
update_qssa_rate_expression()
abstract get_full_rate_expression()
abstract calculate_rate_constants()
class skimpy.InhibitionModifier(inhibitor, name=None, k_inhibition=None, reaction=None)

Bases: skimpy.mechanisms.mechanism.KineticMechanism, ExpressionModifier

Helper class that provides a standard way to create an ABC using inheritance.

prefix = 'IM'
Reactants

Class to define metabolites and their roles in the reaction :return:

Parameters

Class to define parameters and their roles in the reaction :return:

reactant_stoichiometry
modifier(expressions)

change the flux reaction rate expressions :param expression: {vnet, vfwd, vbwd} :return:

get_qssa_rate_expression()
update_qssa_rate_expression()
abstract get_full_rate_expression()
abstract calculate_rate_constants()
class skimpy.HillActivationModifier(activator, name=None, k_activation=None, a_max=None, hill_coefficient=None, reaction=None)

Bases: skimpy.mechanisms.mechanism.KineticMechanism, ExpressionModifier

Helper class that provides a standard way to create an ABC using inheritance.

prefix = 'HAM'
Reactants

Class to define metabolites and their roles in the reaction :return:

Parameters

Class to define parameters and their roles in the reaction :return:

reactant_stoichiometry
modifier(expressions)

change the flux reaction rate expressions :param expression: {vnet, vfwd, vbwd} :return:

get_qssa_rate_expression()
update_qssa_rate_expression()
abstract get_full_rate_expression()
abstract calculate_rate_constants()
class skimpy.SimpleHillActivationModifier(activator, name=None, k_activation=None, a_max=None, hill_coefficient=None, reaction=None)

Bases: skimpy.mechanisms.mechanism.KineticMechanism, ExpressionModifier

Helper class that provides a standard way to create an ABC using inheritance.

prefix = 'SHAM'
Reactants

Class to define metabolites and their roles in the reaction :return:

Parameters

Class to define parameters and their roles in the reaction :return:

reactant_stoichiometry
modifier(expressions)

change the flux reaction rate expressions :param expression: {vnet, vfwd, vbwd} :return:

get_qssa_rate_expression()
update_qssa_rate_expression()
abstract get_full_rate_expression()
abstract calculate_rate_constants()
class skimpy.HillInhibitionModifier(inhibitor, name=None, k_inhibition=None, hill_coefficient=None, reaction=None)

Bases: skimpy.mechanisms.mechanism.KineticMechanism, ExpressionModifier

Helper class that provides a standard way to create an ABC using inheritance.

prefix = 'HIM'
Reactants

Class to define metabolites and their roles in the reaction :return:

Parameters

Class to define parameters and their roles in the reaction :return:

reactant_stoichiometry
modifier(expressions)

change the flux reaction rate expressions :param expression: {vnet, vfwd, vbwd} :return:

get_qssa_rate_expression()
update_qssa_rate_expression()
abstract get_full_rate_expression()
abstract calculate_rate_constants()
skimpy.QSSA = 'qssa'
skimpy.TQSSA = 'tqssa'
skimpy.MCA = 'mca'
skimpy.ODE = 'ode'
skimpy.ELEMENTARY = 'elementary'

Jacobian Types

skimpy.NUMERICAL = 'numerical'
skimpy.SYMBOLIC = 'symbolic'

MCA Types

skimpy.NET = 'net'
skimpy.SPLIT = 'split'

Item types

skimpy.PARAMETER = 'parameter'
skimpy.VARIABLE = 'variable'

Units

skimpy.KCAL = 'kcal'
skimpy.KJ = 'kJ'
skimpy.JOULE = 'JOULE'

OTHER

skimpy.WATER_FORMULA = 'H2O'
class skimpy.Reaction(name, reactants, mechanism, parameters=None, inhibitors=None, enzyme=None)

Bases: object

Global reaction class

name
enzyme = None
modifiers
property reactants
property reactant_stoichiometry
property parameters
property rates
__str__()
parametrize(params)
class skimpy.TabDict

Bases: collections.OrderedDict

Really just an ordered dict with tab completion in interactive terminals

__dir__()

Default dir() implementation.

__getattr__(attr)
iloc(ix)
class skimpy.Item(name, value=None, model=None, suffix='')

Bases: object

name
model = None
value = None
_suffix = ''
_symbol = None
hook = None
type = None
_lower_bound = None
_upper_bound = None
_generate_symbol()
property symbol
property suffix
property bounds
__str__()
__repr__()
class skimpy.ItemSet(mechanism)

Bases: abc.ABC, skimpy.utils.tabdict.TabDict

Helper class that provides a standard way to create an ABC using inheritance.

mechanism
__reduce__()

Helper for pickle.

class skimpy.Parameter(name, required_for=None, value=None, model=None, suffix='')

Bases: Item

type = 'parameter'
class skimpy.ParameterSet(mechanism, param_declaration, param_values, suffix='')

Bases: ItemSet

Helper class that provides a standard way to create an ABC using inheritance.

property required_for
skimpy.make_parameter_set(mechanism, param_declaration)
class skimpy.Reactant(name, value=None, model=None, suffix='')

Bases: Item

type = 'variable'
compartment = None
class skimpy.ReactantSet(mechanism, reactant_declaration, reactant_values)

Bases: ItemSet

Helper class that provides a standard way to create an ABC using inheritance.

skimpy.make_reactant_set(mechanism, reactant_declaration)
skimpy.QSSA = 'qssa'
skimpy.TQSSA = 'tqssa'
skimpy.MCA = 'mca'
skimpy.ODE = 'ode'
skimpy.ELEMENTARY = 'elementary'

Jacobian Types

skimpy.NUMERICAL = 'numerical'
skimpy.SYMBOLIC = 'symbolic'

MCA Types

skimpy.NET = 'net'
skimpy.SPLIT = 'split'

Item types

skimpy.PARAMETER = 'parameter'
skimpy.VARIABLE = 'variable'

Units

skimpy.KCAL = 'kcal'
skimpy.KJ = 'kJ'
skimpy.JOULE = 'JOULE'

OTHER

skimpy.WATER_FORMULA = 'H2O'
class skimpy.TabDict

Bases: collections.OrderedDict

Really just an ordered dict with tab completion in interactive terminals

__dir__()

Default dir() implementation.

__getattr__(attr)
iloc(ix)
class skimpy.ParameterValues(parameter_values, kmodel=None)

Bases: object

Parameters set for kinetic models wich can be indexed with symbols or

_parameter_values
_sym_to_str
__getitem__(item)
__setitem__(item, value)
items()
keys()
values()
class skimpy.ParameterValuePopulation(data, kmodel=None, index=None)

Bases: object

kmodel = None
__getitem__(index)
__len__()
__iter__()
__next__()
_dataframe(dropna=True)
mean()
Return Computes the mean parameter values for the population:

var()
Return Computes the variance parameter values for the population:

cov()
Return Computes the covaraince parameter values for the population:

log_mean()
Return Computes the logarithmic mean parameter values for the population:

log_var()
Return Computes the logarithmic variance parameter values for the population:

log_cov()
Return Computes the logarithmic covaraince parameter values for the population:

save(filename)

Saves the parameter population as hdf5 file :param filename: string XXX.h5 / XXX.hdf5 :return:

skimpy.load_parameter_population(filename, lower_index=None, upper_index=None)
skimpy.concat_populations(values, kmodel=None, index=None)