mass.core.mass_configuration

Define the global configuration values through the MassConfiguration.

Involved in model construction:
Involved in model simulation:
Involved in flux balance analysis (FBA):
Involved in thermodynamics:

Notes

Module Contents

Classes

MassBaseConfiguration

Define global configuration values honored by mass functions.

MassConfiguration

Define the configuration to be Singleton based.

class mass.core.mass_configuration.MassBaseConfiguration[source]

Define global configuration values honored by mass functions.

Notes

The MassConfiguration should be always be used over the MassBaseConfiguration in order for global configuration to work as intended.

property boundary_compartment[source]

Get or set the default value for the boundary compartment.

Parameters

compartment_dict (dict) – A dict containing the identifier of the boundary compartment mapped to the name of the boundary compartment.

property default_compartment[source]

Get or set the default value for the default compartment.

Parameters

compartment_dict (dict) – A dict containing the identifier of the default compartment mapped to the name of the default compartment.

property irreversible_Keq[source]

Get or set the default Keq value of an irreversible reaction.

Notes

MassReaction.equilibrium_constants cannot be negative.

Parameters

value (float) – A non-negative number for the equilibrium constant (Keq) of the reaction.

Raises

ValueError – Occurs when trying to set a negative value.

property irreversible_kr[source]

Get or set the default kr value of an irreversible reaction.

Notes

MassReaction.reverse_rate_constants cannot be negative.

Parameters

value (float) – A non-negative number for the reverse rate constant (kr) of the reaction.

Raises

ValueError – Occurs when trying to set a negative value.

property model_creator[source]

Get or set values for the dict representing the model creator.

Notes

  • A read-only copy of the dict is returned.

  • To successfully export a model creator, all keys must have non-empty string values.

Parameters

creator_dict (dict) –

A dict containing the model creator information where keys are SBML creator fields and values are strings. Keys can only be the following:

  • ’familyName’

  • ’givenName’

  • ’organization’

  • ’email’

Values must be strings or None.

property exclude_metabolites_from_rates[source]

Get or set the metabolites that should be excluded from rates.

Default is dict("elements", [{"H": 2, "O": 1}, {"H": 1}]) to remove the hydrogen and water metabolites using the elements attribute to filter out the hydrogen and water in all rates except the hydrogen and water exchange reactions.

Parameters

to_exclude (dict) – A dict where keys should correspond to a metabolite attribute to utilize for filtering, and values are lists that contain the items to exclude that would be returned by the metabolite attribute. Does not apply to boundary reactions.

property exclude_compartment_volumes_in_rates[source]

Get or set whether to exclude the compartment volumes in rates.

The boundary compartment will always excluded.

Parameters

value (bool) – Whether to exclude the compartment volumes in rate expressions.

property decimal_precision[source]

Get or set the default decimal precision when rounding.

Positive numbers indicated digits to the right of the decimal place, negative numbers indicate digits to the left of the decimal place.

Notes

The decimal_precison is applied as follows:

new_value = round(value, decimal_precison)
Parameters

precision (int or None) – An integer indicating how many digits from the decimal should rounding occur. If None, no rounding will occur.

property steady_state_threshold[source]

Get or set the steady state threshold when using roadrunner solvers.

A threshold for determining whether the RoadRunner steady state solver is at steady state. The steady state solver returns a value indicating how close the solution is to the steady state, where smaller values are better. Values less than the threshold indicate steady state.

Notes

  • With simulations. the absolute difference between the last two points must be less than the steady state threshold.

  • With steady state solvers, the sum of squares of the steady state solution must be less than the steady state threshold.

  • Steady state threshold values cannot be negative.

Parameters

threshold (float) – The threshold for determining whether a steady state occurred.

Raises

ValueError – Occurs when trying to set a negative value.

property solver[source]

Get or set the solver utilized for optimization.

The solver choices are the ones provided by optlang and solvers installed in the environment.

Parameters

solver (str) –

The solver to utilize in optimizations. Valid solvers typically include:

  • "glpk"

  • "cplex"

  • "gurobi"

Raises

cobra.exceptions.SolverNotFound – Occurs for invalid solver values.

property tolerance[source]

Get or set the tolerance value utilized by the optimization solver.

Parameters

tol (float) – The tolerance value to set.

property lower_bound[source]

Get or set the default value of the lower bound for reactions.

Parameters

bound (float) – The default bound value to set.

property upper_bound[source]

Get or set the default value of the lower bound for reactions.

Parameters

bound (float) – The default bound value to set.

property bounds[source]

Get or set the default lower and upper bounds for reactions.

Parameters

bounds (tuple of floats) – A tuple of floats to set as the new default bounds in the form of (lower_bound, upper_bound).

Raises

AssertionError – Occurs when lower bound is greater than the upper bound.

property processes[source]

Return the default number of processes to use when possible.

Number of processes to use where multiprocessing is possible. The default number corresponds to the number of available cores (hyperthreads).

property shared_state[source]

Return a read-only dict for shared configuration attributes.

_repr_html_()[source]

Return the HTML representation of the MassConfiguration.

Warning

This method is intended for internal use only.

__repr__()[source]

Override default repr() for the MassConfiguration.

Warning

This method is intended for internal use only.

class mass.core.mass_configuration.MassConfiguration[source]

Bases: MassBaseConfiguration

Define the configuration to be Singleton based.