8.1.1.6. skimpy.sampling

[———]

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.6.1. Submodules

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

QSSA

TQSSA

MCA

ODE

ELEMENTARY

Jacobian Types

NUMERICAL

SYMBOLIC

MCA Types

NET

SPLIT

Item types

PARAMETER

VARIABLE

Units

KCAL

KJ

JOULE

OTHER

WATER_FORMULA

model_gen

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.6.3. Classes

SaturationParameterFunction

A class used in the process of sampling to calculate Km's. Provided with a

FluxParameterFunction

ParameterSampler

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

SimpleParameterSampler

A simple parameter sampler that samples stable model parameters

GaParameterSampler

A simple parameter sampler that samples stable model parameters

FluxConcentrationSampler

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

SimpleParameterSampler

A simple parameter sampler that samples stable model parameters

FromPyTFA

Class to generate Kinetic models from cobra

ItterableSeries

GaFluxConcentrationSampler

This sampler performs an optimizaion

ParameterValues

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

CMAESParameterSampler

A simple parameter sampler that samples stable model parameters

8.1.1.6.4. Functions

calc_max_eigenvalue(parameter_sample, compiled_model, ...)

Sample one set of staturations using theano complied functions

calc_parameters(saturations, compiled_model, ...[, ...])

default_fitness(saturations[, compiled_model, ...])

run_ea(toolbox[, ngen, stats, hof, verbose])

init_parameters(low, up)

pareto_dominance(x, y)

calc_max_eigenvalue(parameter_sample, compiled_model, ...)

Sample one set of staturations using theano complied functions

calc_parameters(saturations, compiled_model, ...[, ...])

sanitize_cobra_vars(met_name)

convex_mating(ind1, ind2[, eta])

sample_parameters(kmodel, tmodel, individual, ...[, ...])

Run sampling on first order model

deltag0_to_keq(deltag0, temp[, unit, gas_constant])

load_fluxes(solution_raw, tmodel, kmodel[, density, ...])

load_concentrations(solution_raw, tmodel, kmodel[, ...])

load_equilibrium_constants(solution_raw, tmodel, kmodel)

calc_max_eigenvalue(parameter_sample, compiled_model, ...)

Sample one set of staturations using theano complied functions

calc_parameters(saturations, compiled_model, ...[, ...])

run_ea(toolbox[, ngen, stats, hof, verbose])

init_parameters(low, up)

pareto_dominance(x, y)

8.1.1.6.5. Package Contents

class skimpy.SaturationParameterFunction(model, parameters, concentrations)

A class used in the process of sampling to calculate Km’s. Provided with a model, creates self.__call__ function using Cython to calculate Km’s given (sampled) sigmas

Parameters:
  • model

  • parameters – the parameters of the model. Parameters with a .hook

field and an empty .value will be sampled :param concentrations:

sym_concentrations
saturation_parameters
__call__(saturations, parameters, concentrations, parameters_to_resample, fixed_parameters)
class skimpy.FluxParameterFunction(model, parameters, concentration_dict)
sym_concentrations
sym_parameters
expressions
function
__call__(model, parameters, concentration_dict, flux_dict)
class skimpy.ParameterSampler(parameters=None)

Bases: abc.ABC

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

parameters = None
abstract property Parameters

Parameter type specified for the parameters samples :return:

abstract sample()
Returns:

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.SimpleParameterSampler(parameters=None)

Bases: skimpy.sampling.ParameterSampler

A simple parameter sampler that samples stable model parameters with respect to a steady state flux and concentration state

class Parameters

Bases: tuple

Parameter type specified for the parameters samples :return:

n_samples
sample(compiled_model, flux_dict, concentration_dict, only_stable=True, min_max_eigenvalues=False, seed=123, bounds_sample=(0, 1), max_trials=1000000.0)
Returns:

_compile_sampling_functions(model, concentrations, fluxes)

Compiles the function for sampling using cython :param model:

_sample_saturation_step_compiled(compiled_model, concentration_dict, flux_dict, parameters_to_resample=None, fixed_parameters=None)

Sample one set of saturations using cython complied functions :param compiled_model: :param concentration_dict: :param flux_dict: :return:

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'
skimpy.calc_max_eigenvalue(parameter_sample, compiled_model, concentration_dict, flux_dict)

Sample one set of staturations using theano complied functions :param compiled_model: :param concentration_dict: :param flux_dict: :return:

skimpy.calc_parameters(saturations, compiled_model, concentration_dict, flux_dict, parameters_to_resample=None, fixed_parameters=None)
skimpy.default_fitness(saturations, compiled_model=None, concentration_dict=dict(), flux_dict=dict(), max_eigenvalue=0)
class skimpy.GaParameterSampler(parameters=None)

Bases: skimpy.sampling.ParameterSampler

A simple parameter sampler that samples stable model parameters with respect to a steady state flux and concentration state

class Parameters

Bases: tuple

Parameter type specified for the parameters samples :return:

n_samples
sample(compiled_model, flux_dict, concentration_dict, seed=123, max_generation=10, mutation_probability=0.2, eta=20, fitness_fun=default_fitness, fitness_weights=(-1,), **kwargs)
Parameters:
  • compiled_model

  • flux_dict

  • concentration_dict

  • seed

  • max_generation

  • mutation_probability

  • eta

Returns:

_compile_sampling_functions(model, concentrations, fluxes)

Compliles the function for sampling using theano :param model:

skimpy.run_ea(toolbox, stats=None, verbose=False)
skimpy.init_parameters(low, up)
skimpy.pareto_dominance(x, y)
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'
skimpy.calc_max_eigenvalue(parameter_sample, compiled_model, concentration_dict, flux_dict)

Sample one set of staturations using theano complied functions :param compiled_model: :param concentration_dict: :param flux_dict: :return:

skimpy.calc_parameters(saturations, compiled_model, concentration_dict, flux_dict, parameters_to_resample=None, fixed_parameters=None)
skimpy.sanitize_cobra_vars(met_name)
class skimpy.FluxConcentrationSampler(parameters=None)

Bases: abc.ABC

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

parameters = None
abstract property Parameters

Parameter type specified for the parameters sampling procedure :return:

abstract sample()
Returns:

class skimpy.SimpleParameterSampler(parameters=None)

Bases: skimpy.sampling.ParameterSampler

A simple parameter sampler that samples stable model parameters with respect to a steady state flux and concentration state

class Parameters

Bases: tuple

Parameter type specified for the parameters samples :return:

n_samples
sample(compiled_model, flux_dict, concentration_dict, only_stable=True, min_max_eigenvalues=False, seed=123, bounds_sample=(0, 1), max_trials=1000000.0)
Returns:

_compile_sampling_functions(model, concentrations, fluxes)

Compiles the function for sampling using cython :param model:

_sample_saturation_step_compiled(compiled_model, concentration_dict, flux_dict, parameters_to_resample=None, fixed_parameters=None)

Sample one set of saturations using cython complied functions :param compiled_model: :param concentration_dict: :param flux_dict: :return:

class skimpy.FromPyTFA(max_revesible_deltag_0=100, **kwargs)

Bases: skimpy.io.generate_from_cobra.FromCobra

Class to generate Kinetic models from cobra

max_revesible_deltag_0 = 100
import_model(pytfa_model, pytfa_solution_raw, concentration_scaling_factor=1.0)

Function to create a kinetic model from a constraint based model

Parameters:
  • pytfa_model

  • pytfa_solution – a prepresentative solution for the pytfa model solution.raw

Returns:

skimpy model

get_equlibrium_constant(pytfa_model, pytfa_solution_data, this_reaction, scaling_factor=1.0)
class skimpy.ItterableSeries(this_series)
data
__iter__()
skimpy.model_gen
class skimpy.GaFluxConcentrationSampler(parameters=None)

Bases: skimpy.sampling.flux_concentration_sampler.FluxConcentrationSampler

This sampler performs an optimizaion

class Parameters

Bases: tuple

Parameter type specified for the parameters sampling procedure :return:

n_samples
n_parameter_samples
max_generation
seed
mutation_probability
crossover_scaling
max_eigenvalue
min_eigenvalue
scaling_parameters
sample(tmodel, kmodel, simple_parameter_sampler, only_stable=True)
Parameters:
  • compiled_model

  • flux_dict

  • concentration_dict

  • seed

  • max_generation

  • mutation_probability

  • eta

Returns:

fitness(flux_concentration)
run_ea(toolbox, stats=None, verbose=False)
sample_tfa_model(n_samples)
Parameters:
  • tmodel – pytfa.tmodel

  • n_samples – integer

Returns:

TODO pd.DataFrame indexed with reaction names and metabolite concentrations

mutate_ind(ind)
skimpy.convex_mating(ind1, ind2, eta=0.5)
skimpy.sample_parameters(kmodel, tmodel, individual, param_sampler, scaling_parameters, only_stable=True)

Run sampling on first order model

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'
skimpy.deltag0_to_keq(deltag0, temp, unit=KCAL, gas_constant=None)
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()
skimpy.load_fluxes(solution_raw, tmodel, kmodel, density=None, ratio_gdw_gww=None, concentration_scaling=None, time_scaling=None, xmol_in_flux=0.001)
skimpy.load_concentrations(solution_raw, tmodel, kmodel, concentration_scaling=None)
skimpy.load_equilibrium_constants(solution_raw, tmodel, kmodel, concentration_scaling=None, in_place=False)
skimpy.calc_max_eigenvalue(parameter_sample, compiled_model, concentration_dict, flux_dict)

Sample one set of staturations using theano complied functions :param compiled_model: :param concentration_dict: :param flux_dict: :return:

skimpy.calc_parameters(saturations, compiled_model, concentration_dict, flux_dict, parameters_to_resample=None, fixed_parameters=None)
class skimpy.CMAESParameterSampler(parameters=None)

Bases: skimpy.sampling.ParameterSampler

A simple parameter sampler that samples stable model parameters with respect to a steady state flux and concentration state

class Parameters

Bases: tuple

Parameter type specified for the parameters samples :return:

n_samples
sample(compiled_model, flux_dict, concentration_dict, seed=123, max_generation=10, sigma=0.1, lambda_=1000, nhof=100, max_eigenvalue=0, min_km=0.001, max_km=1000.0)
Parameters:
  • compiled_model

  • flux_dict

  • concentration_dict

  • seed

  • max_generation

  • mutation_probability

  • eta

Returns:

_compile_sampling_functions(model, concentrations, fluxes)

Compliles the function for sampling using theano :param model:

fitness(parameters)
update_parameters(parameters)
skimpy.run_ea(toolbox, ngen=None, stats=None, hof=None, verbose=False)
skimpy.init_parameters(low, up)
skimpy.pareto_dominance(x, y)
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'