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. Package Contents

8.1.1.2.2.1. 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.2.2. 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=None, upper_index=None)

concat_populations(values, kmodel=None, index=None)

8.1.1.2.2.3. 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

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:

property reactants(self)
property parameters(self)
property moieties(self)
add_reaction(self, reaction)

Adds a SKiMPy reaction to the model

Parameters

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

Returns

add_compartment(self, compartment)
Parameters

compartment

Returns

add_constraint(self, constraint)
add_boundary_condition(self, 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(self, element, kind)
parametrize_by_reaction(self, param_dict)
If has input: apply as dict to reactions in the model by

reaction.parametrize(args)

Returns

parametrize(self, param_dict)
repair(self)

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

property sim_type(self)
prepare(self, 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(self, type=NUMERICAL, sim_type=QSSA, ncpu=1)
compile_ode(self, sim_type=QSSA, ncpu=1)
solve_ode(self, 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(self, 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.

__reduce__(self)

helper for pickle

property parameters(self)
property Reactants(self)

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

property Parameters(self)

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

abstract get_qssa_rate_expression(self)
abstract update_qssa_rate_expression(self)
abstract get_full_rate_expression(self)
abstract calculate_rate_constants(self)
get_parameters_from_expression(self, 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
__call__(self, expressions)
property modifier(self)

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

property name(self)
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
modifier(self, expressions)

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

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

Bases: ExpressionModifier

Add a concentration rate term to your rate expression

prefix = ADDCR
modifier(self, 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(self, 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
Parameters
modifier(self, expressions)

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

get_qssa_rate_expression(self)
update_qssa_rate_expression(self)
abstract get_full_rate_expression(self)
abstract calculate_rate_constants(self)
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
Parameters
modifier(self, expressions)

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

get_qssa_rate_expression(self)
update_qssa_rate_expression(self)
abstract get_full_rate_expression(self)
abstract calculate_rate_constants(self)
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
Parameters
modifier(self, expressions)

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

get_qssa_rate_expression(self)
update_qssa_rate_expression(self)
abstract get_full_rate_expression(self)
abstract calculate_rate_constants(self)
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
Parameters
modifier(self, expressions)

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

get_qssa_rate_expression(self)
update_qssa_rate_expression(self)
abstract get_full_rate_expression(self)
abstract calculate_rate_constants(self)
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
Parameters
modifier(self, expressions)

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

get_qssa_rate_expression(self)
update_qssa_rate_expression(self)
abstract get_full_rate_expression(self)
abstract calculate_rate_constants(self)
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
Parameters
modifier(self, expressions)

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

get_qssa_rate_expression(self)
update_qssa_rate_expression(self)
abstract get_full_rate_expression(self)
abstract calculate_rate_constants(self)
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
Parameters
modifier(self, expressions)

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

get_qssa_rate_expression(self)
update_qssa_rate_expression(self)
abstract get_full_rate_expression(self)
abstract calculate_rate_constants(self)
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

property reactants(self)
property reactant_stoichiometry(self)
property parameters(self)
property rates(self)
__str__(self)

Return str(self).

parametrize(self, params)
class skimpy.TabDict

Bases: collections.OrderedDict

Really just an ordered dict with tab completion in interactive terminals

__dir__(self)

__dir__() -> list default dir() implementation

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

Bases: object

_generate_symbol(self)
property symbol(self)
property suffix(self)
property bounds(self)
__str__(self)

Return str(self).

__repr__(self)

Return repr(self).

class skimpy.ItemSet(mechanism)

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

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

__reduce__(self)

helper for pickle

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

Bases: Item

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(self)
skimpy.make_parameter_set(mechanism, param_declaration)
class skimpy.Reactant(name, value=None, model=None, suffix='')

Bases: Item

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__(self)

__dir__() -> list default dir() implementation

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

Bases: object

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

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

Bases: object

__getitem__(self, index)
__len__(self)
__iter__(self)
__next__(self)
_dataframe(self, dropna=True)
mean(self)
Return Computes the mean parameter values for the population

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

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

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

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

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

save(self, 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)