mass.core.mass_metabolite

MassMetabolite is a class for holding information regarding metabolites.

The MassMetabolite class inherits and extends the Metabolite class in cobra. It contains additional information required for simulations and other mass functions and workflows.

Some key differences between the cobra.Metabolite and the mass.MassMetabolite are listed below:

  • Unlike the cobra.Metabolite the id initialization argument has been replaced with id_or_specie to be clear in that a new MassMetabolite can be instantiated with the same properties of a previously created metabolite by passing the metabolite object to this argument.

  • The formulas can have moieties by placing them within square brackets (e.g. "[ENZYME]")

Module Contents

Classes

MassMetabolite

Class for holding information regarding a metabolite.

class mass.core.mass_metabolite.MassMetabolite(id_or_specie=None, name='', formula=None, charge=None, compartment=None, fixed=False)[source]

Bases: cobra.core.metabolite.Metabolite

Class for holding information regarding a metabolite.

Parameters
  • id_or_specie (str, Metabolite, MassMetabolite) – A string identifier to associate with the metabolite, or an existing metabolite object. If an existing metabolite object is provided, a new MassMetabolite is instantiated with the same properties as the original metabolite.

  • name (str) – A human readable name for the metabolite.

  • formula (str) – Chemical formula associated with the metabolite (e.g. H2O).

  • charge (float) – The charge number associated with the metabolite.

  • compartment (str) – Compartment of the metabolite.

  • fixed (bool) – Whether the metabolite concentration should remain at a fixed value. Default is False.

property elements[source]

Get or set dict of elements in the formula.

Parameters

elements_dict (dict) – A dict representing the elements of the chemical formula where keys are elements and values are the amount.

Notes

  • Enzyme and macromolecule moieties can be recognized by enclosing them in brackets (e.g. [ENZYME]) when defining the chemical formula. They are treated as one entity and therefore are only counted once.

  • Overrides elements() of the cobra.Metabolite to allow for the use of moieties.

property initial_condition[source]

Get or set the initial condition of the metabolite.

When using a HistoryManager context, this attribute can be set temporarily, reversed when the exiting the context.

Notes

Initial conditions of metabolites cannot be negative.

Parameters

value (float) – A non-negative number for the concentration of the metabolite.

Raises

ValueError – Occurs when trying to set a negative value.

property fixed[source]

Get or set whether the metabolite remains constant.

When using a HistoryManager context, this attribute can be set temporarily, reversed when the exiting the context.

Parameters

value (bool) – Whether the metabolite should remain constant, meaning that the metabolite ODE is 0.

property ordinary_differential_equation[source]

Return a sympy expression of the metabolite’s associated ODE.

Will return None if metabolite is not associated with a MassReaction, or 0. if the fixed attribute is set as True.

property formula_weight[source]

Calculate and return the formula weight of the metabolite.

Does not consider any moieties enclosed in brackets.

Notes

Overrides formula_weight() of the cobra.Metabolite to allow for the use of moieties.

property model[source]

Return the MassModel associated with the metabolite.

property ic[source]

Alias for the initial_condition.

property ode[source]

Alias for the ordinary_differential_equation.

_remove_compartment_from_id_str()[source]

Remove the compartment from the ID str of the metabolite.

Warning

This method is intended for internal use only.

_repr_html_()[source]

HTML representation of the overview for the MassMetabolite.

Warning

This method is intended for internal use only.

__dir__()[source]

Override default dir() implementation to list only public items.

Warning

This method is intended for internal use only.