4.1.1.4. wc_lang.transform package

4.1.1.4.1. Submodules

4.1.1.4.2. wc_lang.transform.change_value module

Change a value of an attribute of a model

Author

Jonathan Karr <karr@mssm.edu>

Date

2018-06-19

Copyright

2018, Karr Lab

License

MIT

class wc_lang.transform.change_value.ChangeValueTransform(attr_path=None, value=None)[source]

Bases: wc_lang.transform.core.Transform

Change a value of an attribute of a model

attr_path[source]

list that represents the path to an attribute or nested attribute of a model

Examples:

model.name --> 'name'
model.reactions.get_one(id='rxn_1').reversible --> (('reactions', {'id': 'rxn_1'}), 'reversible')
model.parameters.get_one(id='param_1').value --> (('parameters', {'id': 'param_1'}), 'value')
model                     .reactions.get_one(id='rxn_1')                     .rate_laws.get_one(direction=RateLawDirection.forward)                     .expression                     .parameters.get_one(id='param_1')                     .value
  --> (
        ('reactions', {'id': 'rxn_1'},
        ('rate_laws', {'direction': RateLawDirection.forward}),
        'expression',
        ('parameters', {'id': 'param_1'}),
        'value',
      )
Type

list of list of str

value[source]

new value

Type

object

class Meta[source]

Bases: object

id = 'ChangeValue'[source]
label = 'Change a value of an attribute of a model'[source]
__eq__(other, tol=0.0)[source]

Compare two ChangeValueTransform objects

Parameters
  • other (Object) – other object

  • tol (float, optional) – equality tolerance

Returns

true if ChangeValueTransform objects are semantically equal

Return type

bool

static attr_path_from_str(str)[source]

Generate attr_path from its string representation

Parameters

str (str) – string representation of attr_path

Returns

attr_path

Return type

Object

attr_path_to_str()[source]

Generate a string representation of attr_path

Returns

string representation of attr_path

Return type

str

run(model)[source]

Change a value of an attribute of a model

Parameters

model (Model) – model

Returns

same model, but with a different value of an attribute

Return type

Model

4.1.1.4.3. wc_lang.transform.core module

Transform models.

Author

Jonathan Karr <karr@mssm.edu>

Date

2016-11-10

Copyright

2016, Karr Lab

License

MIT

class wc_lang.transform.core.CompositeTransform[source]

Bases: wc_lang.transform.core.Transform

Transform which is composed of multiple transforms

COMPONENT_TRANSFORMS[source]

default transforms

Type

tuple of Transform

COMPONENT_TRANSFORMS = ()[source]
run(model)[source]

Transform model

Parameters

model (Model) – model

Returns

same model, but transformed

Return type

Model

class wc_lang.transform.core.Transform[source]

Bases: abc.ABC

abstract run(model)[source]

Transform a model

Parameters

model (Model) – model

Returns

transformed model

Return type

Model

wc_lang.transform.core.get_transforms()[source]

Get dictionary of available transform classes

Returns

class: dictionary of available transform classes

Return type

dict of str

4.1.1.4.4. wc_lang.transform.create_implicit_dfba_ex_rxns module

Create implicit exchange reactions for dFBA submodels.

Author

Arthur Goldberg <Arthur.Goldberg@mssm.edu>

Author

Jonathan Karr <jonrkarr@gmail.com>

Date

2018-11-28

Copyright

2017-2018, Karr Lab

License

MIT

class wc_lang.transform.create_implicit_dfba_ex_rxns.CreateImplicitDfbaExchangeReactionsTransform[source]

Bases: wc_lang.transform.core.Transform

Create implicit exchange reactions for dFBA submodels.

To enable FBA to represent a closed system, create implicit forward exchange reactions

  • Metabolites transported from the extracellular environment (generate a “-> species_type[e]” reaction for each extracellular species involved in each dFBA submodel)

  • TODO: Metabolites recycled from the byproducts of other submodels and products produced for other submodels

class Meta[source]

Bases: object

id = 'CreateImplicitDfbaExchangeReactions'[source]
label = 'Create implicit exchange reactions for dFBA submodels'[source]
run(model)[source]

Create implicit exchange reactions for dFBA submodels

Parameters

model (Model) – model

Returns

same model, but transformed

Return type

Model

4.1.1.4.5. wc_lang.transform.create_implicit_dist_zero_init_concs module

Create the implicit zero concentrations in a model

Author

Arthur Goldberg <Arthur.Goldberg@mssm.edu>

Author

Jonathan Karr <jonrkarr@gmail.com>

Date

2018-11-28

Copyright

2017-2018, Karr Lab

License

MIT

class wc_lang.transform.create_implicit_dist_zero_init_concs.CreateImplicitDistributionZeroInitConcentrationsTransform[source]

Bases: wc_lang.transform.core.Transform

Create the implicit zero concentrations in a model

class Meta[source]

Bases: object

id = 'CreateImplicitDistributionZeroInitConcentrations'[source]
label = 'Create the implicit zero concentrations in a model'[source]
run(model)[source]

Create the implicit zero concentrations in a model

Parameters

model (Model) – model

Returns

same model, but transformed

Return type

Model

4.1.1.4.6. wc_lang.transform.merge_submodels module

Merge groups of algorithmically-like submodels into individual submodels.

Author

Jonathan Karr <karr@mssm.edu>

Date

2018-06-19

Copyright

2018, Karr Lab

License

MIT

class wc_lang.transform.merge_submodels.MergeAlgorithmicallyLikeSubmodelsTransform[source]

Bases: wc_lang.transform.core.Transform

Merge groups of algorithmically-like submodels into individual submodels

class Meta[source]

Bases: object

id = 'MergeAlgorithmicallyLikeSubmodels'[source]
label = 'Merge groups of algorithmically-like submodels into individual submodels'[source]
run(model)[source]

Merge groups of algorithmically-like submodels into individual submodels

  • dFBA objectives are merged by summing

Parameters

model (Model) – model definition

Returns

same model definition, but with submodels of the same simulation framework merged

Return type

Model

4.1.1.4.7. wc_lang.transform.nullify_attrs module

Generate a reduced model by nullifying specific attributes

Author

Jonathan Karr <karr@mssm.edu>

Date

2019-03-20

Copyright

2019, Karr Lab

License

MIT

class wc_lang.transform.nullify_attrs.NullifyAttrsTransform(attrs_to_keep)[source]

Bases: wc_lang.transform.core.Transform

Generate a reduced model by nullifying specific attributes

attrs_to_keep[source]

name of meta attribute which encodes lists of the attributes to keep (not nullify)

Type

str

class Meta[source]

Bases: object

id = 'NullifyAttrs'[source]
label = 'Generate a reduced model by nullifying specific attributes'[source]
run(model)[source]

Generate a reduced model by nullifying specific attributes

Parameters

model (Model) – model

Returns

same model, but transformed

Return type

Model

4.1.1.4.8. wc_lang.transform.prep_for_sbml module

Transform model into SBML-compatible representation and discard information that cannot be exported to SBML.

Author

Jonathan Karr <karr@mssm.edu>

Author

Arthur Goldberg <Arthur.Goldberg@mssm.edu>

Date

2019-03-20

Copyright

2019, Karr Lab

License

MIT

class wc_lang.transform.prep_for_sbml.PrepForSbmlTransform[source]

Bases: wc_lang.transform.core.CompositeTransform

Transform model into SBML-compatible representation and discard information that cannot be exported to SBML

COMPONENT_TRANSFORMS = (<wc_lang.transform.create_implicit_dist_zero_init_concs.CreateImplicitDistributionZeroInitConcentrationsTransform object>, <wc_lang.transform.create_implicit_dfba_ex_rxns.CreateImplicitDfbaExchangeReactionsTransform object>, <wc_lang.transform.split_reversible_reactions.SplitReversibleReactionsTransform object>, <wc_lang.transform.nullify_attrs.NullifyAttrsTransform object>)[source]
class Meta[source]

Bases: object

id = 'PrepForSbml'[source]
label = 'Transform model into SBML-compatible representation and discard information that cannot be exported to SBML'[source]
dfba_framework = [Term('WC:dynamic_flux_balance_analysis', name='dynamic flux balance analysis')][source]

4.1.1.4.9. wc_lang.transform.prep_for_wc_sim module

Prepare a model for simulation by wc_sim.

Author

Arthur Goldberg <Arthur.Goldberg@mssm.edu>

Author

Jonathan Karr <jonrkarr@gmail.com>

Date

2018-11-28

Copyright

2017-2018, Karr Lab

License

MIT

class wc_lang.transform.prep_for_wc_sim.PrepForWcSimTransform[source]

Bases: wc_lang.transform.core.CompositeTransform

Prepare a model for simulation by making implicit information in the model explicit.

  • Create explicit distributions of initial zero concentrations for species that don’t have explicit distributions of initial concentrations (i.e. implicit distributions of initial zero concentrations)

  • Create implicit exchange reactions for dFBA submodels

  • Clip the flux bounds for the reactions in dFBA submodels to the default flux range

  • Split reversible reactions into separate forward and reverse reactions

COMPONENT_TRANSFORMS = (<wc_lang.transform.create_implicit_dist_zero_init_concs.CreateImplicitDistributionZeroInitConcentrationsTransform object>, <wc_lang.transform.create_implicit_dfba_ex_rxns.CreateImplicitDfbaExchangeReactionsTransform object>, <wc_lang.transform.set_finite_dfba_flux_bounds.SetFiniteDfbaFluxBoundsTransform object>, <wc_lang.transform.split_reversible_reactions.SplitReversibleReactionsTransform object>, <wc_lang.transform.nullify_attrs.NullifyAttrsTransform object>)[source]
class Meta[source]

Bases: object

id = 'PrepForWCSim'[source]
label = 'Prepare model for simulation by making implicit information in the model explicit'[source]

4.1.1.4.10. wc_lang.transform.set_finite_dfba_flux_bounds module

Clip the flux bounds for the reactions in dFBA submodels

Author

Arthur Goldberg <Arthur.Goldberg@mssm.edu>

Author

Jonathan Karr <jonrkarr@gmail.com>

Date

2018-11-28

Copyright

2017-2018, Karr Lab

License

MIT

class wc_lang.transform.set_finite_dfba_flux_bounds.SetFiniteDfbaFluxBoundsTransform[source]

Bases: wc_lang.transform.core.Transform

Clip the flux bounds for the reactions in dFBA submodels to the default flux range

Bounds need to be clipped because some linear programming solvers require finite minimum and maximum flux bounds. The default bounds are provided in the wc_lang configuration.

Specifically, the default minimum and maximum flux bounds are applied as follows:

  • reversible reactions:

    • flux_min = max(flux_min, flux_min_bound_reversible)

    • flux_max = min(flux_max, flux_max_bound)

  • irreversible reactions:

    • flux_min = max(flux_min, flux_min_bound_irreversible)

    • flux_max = min(flux_max, flux_max_bound)

class Meta[source]

Bases: object

id = 'SetFiniteDfbaFluxBoundsTransform'[source]
label = 'Clip the flux bounds for the reactions in dFBA submodels to the default flux range'[source]
run(model)[source]

Transform model

Parameters

model (Model) – model

Returns

same model, but transformed

Return type

Model

4.1.1.4.11. wc_lang.transform.split_reversible_reactions module

Transform models.

Author

Jonathan Karr <karr@mssm.edu>

Author

Arthur Goldberg <Arthur.Goldberg@mssm.edu>

Date

2018-06-19

Copyright

2018, Karr Lab

License

MIT

class wc_lang.transform.split_reversible_reactions.SplitReversibleReactionsTransform(excluded_frameworks=None)[source]

Bases: wc_lang.transform.core.Transform

Split reversible reactions in submodels into separate forward and backward reactions

class Meta[source]

Bases: object

id = 'SplitReversibleReactions'[source]
label = 'Split reversible reactions into separate forward and backward reactions'[source]
run(model)[source]

Split reversible reactions in submodels into separate forward and backward reactions

Parameters

model (Model) – model definition

Returns

same model definition, but with reversible reactions split into separate forward and backward reactions, their flux bounds adjusted accordingly, and the dFBA objective expression adjusted accordingly

Return type

Model

4.1.1.4.12. Module contents