2.1. wc_model_gen package

2.1.2. Submodules

2.1.3. wc_model_gen._version module

2.1.4. wc_model_gen.core module

Base classes for generating wc_lang-formatted models from a knowledge base.

Author

Balazs Szigeti <balazs.szigeti@mssm.edu>

Author

Jonathan Karr <jonrkarr@gmail.com>

Author

Yin Hoon Chew <yinhoon.chew@mssm.edu>

Date

2018-01-21

Copyright

2018, Karr Lab

License

MIT

class wc_model_gen.core.ModelComponentGenerator(knowledge_base, model, options=None)[source]

Bases: object

Abstract base class for model component generators

knowledge_base[source]

knowledge base

Type

wc_kb.core.KnowledgeBase

model[source]

model

Type

wc_lang.Model

options[source]

options

Type

dict, optional

clean_and_validate_options()[source]

Apply default options and validate options

abstract run()[source]

Generate model components

class wc_model_gen.core.ModelGenerator(knowledge_base, component_generators=None, options=None)[source]

Bases: object

Generator for models (wc_lang.Model)

knowledge_base[source]

knowledge base

Type

wc_kb.core.KnowledgeBase

component_generators[source]

model component generators

Type

list of ModelComponentGenerator

options[source]

dictionary of options whose keys are the names of component generator classes and whose values are dictionaries of options for the component generator classes

Type

dict, optional

DEFAULT_COMPONENT_GENERATORS = ()[source]
static analyze_model(self, results)[source]

Prints the standard analysis of simulation results

clean_and_validate_options()[source]

Apply default options and validate options

static gen_rand_min_model_kb(name=None)[source]

Generates a random min model KB

run()[source]

Generate a wc_lang model from a wc_kb knowledge base

Returns

model

Return type

wc_lang.Model

static run_model(model, results_dir, checkpoint_period=5, end_time=100)[source]

Simulates model

class wc_model_gen.core.SubmodelGenerator(knowledge_base, model, options=None)[source]

Bases: wc_model_gen.core.ModelComponentGenerator

Base class for submodel generators

knowledge_base[source]

knowledge base

Type

wc_kb.core.KnowledgeBase

model[source]

model

Type

wc_lang.Model

submodel[source]

submodel

Type

wc_lang.Submodel

options[source]

options

Type

dict, optional

calibrate_submodel()[source]

Calibrate the submodel using data in the KB

clean_and_validate_options()[source]

Apply default options and validate options

gen_rate_laws()[source]

Generate rate laws for the reactions in the submodel

gen_reactions()[source]

Generate reactions associated with the submodel

run()[source]

Generate model components

2.1.5. wc_model_gen.global_vars module

Global variables for storing temporary information during model generation

Author

Yin Hoon Chew <yinhoon.chew@mssm.edu>

Date

2019-10-04

Copyright

2019, Karr Lab

License

MIT

2.1.6. wc_model_gen.utils module

Utility methods for generating submodels

Author

Yin Hoon Chew <yinhoon.chew@mssm.edu>

Date

2019-01-23

Copyright

2019, Karr Lab

License

MIT

wc_model_gen.utils.calc_avg_deg_rate(mean_concentration, half_life)[source]

Calculate the average degradation rate of a species over a cell cycle

Parameters
  • mean_concentration (float) – species mean concentration

  • half_life (float) – species half life

Returns

the average degradation rate of the species

Return type

float

wc_model_gen.utils.calc_avg_syn_rate(mean_concentration, half_life, mean_doubling_time)[source]

Calculate the average synthesis rate of a species over a cell cycle

Parameters
  • mean_concentration (float) – species mean concentration

  • half_life (float) – species half life

  • mean_doubling_time (float) – mean doubling time of cells

Returns

the average synthesis rate of the species

Return type

float

wc_model_gen.utils.gen_mass_action_rate_law(model, reaction, model_k, modifiers=None, modifier_reactants=None)[source]

Generate a mass action rate law.

Example

Rate = k * [E1] * [S1]

where

k_: rate constant (e.g.: association, dissociation or catalytic constant) [En]: concentration of nth enzyme (modifier) [Sn]: concentration of nth substrate

Parameters
  • model (wc_lang.Model) – model

  • reaction (wc_lang.Reaction) – reaction

  • modifiers (list of wc_lang.Observable) – list of observables, each of which evaluates to the total concentration of all enzymes that catalyze the same intermediate step in the reaction

  • modifier_reactants (list of wc_lang.Species) – list of species in modifiers that should be included as reactants in the rate law

Returns

rate law list of wc_lang.Parameter: list of parameters in the rate law

Return type

wc_lang.RateLawExpression

wc_model_gen.utils.gen_michaelis_menten_like_propensity_function(model, reaction, substrates_as_modifiers=None, exclude_substrates=None)[source]

Generate a Michaelis-Menten-like propensity function. For species that are considered ‘substrates’, the substrate term is formulated as the multiplication of a Hill equation with a coefficient of 1 for each ‘substrate’. For species that are considered ‘modifiers’, the modifier term is formulated as the multiplication of the modifier concentrations.

Example

Rate = k_cat * [E1] * [E2] * [S1]/(Km_S1 + [S1]) * [S2]/(Km_S2 + [S2])

where

k_cat: catalytic constant [En]: concentration of nth modifier [Sn]: concentration of nth substrate Km_Sn: Michaelis-Menten constant for nth substrate

Parameters
  • model (wc_lang.Model) – model

  • reaction (wc_lang.Reaction) – reaction

  • substrates_as_modifiers (list of wc_lang.Species) – list of reactant species that should be considered as modifiers in the rate law

  • exclude_substrates (list of wc_lang.Species) – list of reactant species that would be excluded from the rate law

Returns

rate law list of wc_lang.Parameter: list of parameters in the rate law

Return type

wc_lang.RateLawExpression

wc_model_gen.utils.gen_michaelis_menten_like_rate_law(model, reaction, modifiers=None, modifier_reactants=None, exclude_substrates=None)[source]

Generate a Michaelis-Menten-like rate law. For a multi-substrate reaction, the substrate term is formulated as the multiplication of a Hill equation with a coefficient of 1 for each substrate. For multi-steps reaction where each step is catalyzed by a different enzyme, the enzyme term is formulated as the multiplication of all the enzyme concentrations.

Example

Rate = k_cat * [E1] * [E2] * [S1]/(Km_S1 + [S1]) * [S2]/(Km_S2 + [S2])

where

k_cat: catalytic constant

[En]: concentration of nth enzyme (modifier) [Sn]: concentration of nth substrate Km_Sn: Michaelis-Menten constant for nth substrate

Parameters
  • model (wc_lang.Model) – model

  • reaction (wc_lang.Reaction) – reaction

  • modifiers (list of wc_lang.Observable or wc_lang.Species) – list of observables (each of which evaluates to the total concentration of all enzymes that catalyze the same intermediate step in the reaction) or enzyme species (that catalyze the reaction)

  • modifier_reactants (list of wc_lang.Species) – list of species in modifiers that should be included as reactants in the rate law

  • exclude_substrates (list of wc_lang.Species) – list of reactant species that would be excluded from the rate law

Returns

rate law list of wc_lang.Parameter: list of parameters in the rate law

Return type

wc_lang.RateLawExpression

wc_model_gen.utils.gen_response_functions(model, beta, reaction_id, reaction_class, compartment, reaction_factors)[source]
Generate a list of response function expression string for each factor or

group of factors (F) in the form of:

F/(Km + F)

Parameters
  • model (wc_lang.Model) – model

  • beta (float) – ratio of Michaelis-Menten constant to substrate concentration (Km/[S]) for use when estimating Km values

  • reaction_id (str) – identifier of reaction whose rate law will use the function expressions

  • reaction_class (str) – generic class that the reaction belongs to which shares the same observables in their rate laws, e.g. ‘translation_initiation’ for each gene that shares the same initiation factors

  • compartment (wc_lang.Compartment) – compartment where the reaction occurs

  • reaction_factors (list of list) – list of lists of the ID or name of (initiation/elongation/translocation) factors, grouped based on similar functions or classes, e.g. [[‘factor1 variant1’, ‘factor1 variant2’], [‘factor2’]]

Returns

list of strings of response function expression for each factor/group of factors dict: IDs of species (keys) and their species objects (values) dict: IDs of parameters (keys) and their parameter objects (values) dict: IDs of volume density functions (keys) and their function objects (values) dict: IDs of observables (keys) and their observable objects (values)

Return type

list

wc_model_gen.utils.simple_activator(model, reaction_id, activator)[source]

Generate the parameters and string expression of the regulation factor derived in Bintu et al (2005) for the case of a simple activator

Parameters
  • model (wc_lang.Model) – model

  • reaction_id (str) – reaction id

  • activator (wc_lang.Species) – activator

Returns

string expression of the regulation factor dict of wc_lang.Species: dict of species in the expression

with the species ids as keys and the species objects as values

dict of wc_lang.Parameter: dict of parameters in the expression

with the parameter ids as keys and the parameter objects as values

dict of wc_lang.Function: dict of functions in the expression

with the function ids as keys and the function objects as values

Return type

str

wc_model_gen.utils.simple_repressor(model, reaction_id, repressor)[source]

Generate the parameters and string expression of the regulation factor derived in Bintu et al (2005) for the case of a simple repressor

Parameters
  • model (wc_lang.Model) – model

  • reaction_id (str) – reaction id

  • repressor (wc_lang.Species) – repressor

Returns

string expression of the regulation factor dict of wc_lang.Species: dict of species in the expression

with the species ids as keys and the species objects as values

dict of wc_lang.Parameter: dict of parameters in the expression

with the parameter ids as keys and the parameter objects as values

dict of wc_lang.Function: dict of functions in the expression

with the function ids as keys and the function objects as values

Return type

str

wc_model_gen.utils.test_metabolite_production(submodel, reaction_bounds, pseudo_reactions=None, test_producibles=None, test_recyclables=None)[source]

Test that an FBA metabolism submodel can produce each reactant component (producible) and recycle each product component (recyclable) in each reaction in the objective function individually. First, a source (sink) reaction is added for each reactant (product) component. Each source (sink) reaction is then set as the objective function to be maximized. If the solution returns a zero objective function, that indicates the submodel cannot produce (recycle) the associated reactant (product) component.

Parameters
  • submodel (wc_lang.Submodel) – FBA metabolism submodel

  • reaction_bounds (dict) – a dictionary with reaction IDs as keys and tuples of (lower bound, upper bound) as values

  • pseudo_reactions (list of str, optional) – list of IDs of pseudo-reactions that will be excluded from the optimization formulation

  • test_producibles (list of str, optional) – list of IDs of species to be tested for producibility in the submodel; if nothing is provided, the species will be extracted from the reactants in the objective reactions

  • test_recyclables (list of str, optional) – list of IDs of species to be tested for recyclability in the submodel; if nothing is provided, the species will be extracted from the products in the objective reactions

Returns

list of species IDs of metabolites that cannot be produced

in the metabolism submodel

list: list of species IDs of metabolites that cannot be recycled

in the metabolism submodel

Return type

list

2.1.7. Module contents