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
theid
initialization argument has been replaced withid_or_specie
to be clear in that a newMassMetabolite
can be instantiated with the same properties of a previously created metabolite by passing the metabolite object to this argument.The
formula
s can have moieties by placing them within square brackets (e.g."[ENZYME]"
)
Module Contents
Classes
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(self)[source]
Get or set
dict
of elements in theformula
.- 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 thecobra.Metabolite
to allow for the use of moieties.
- property initial_condition(self)[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(self)[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(self)[source]
Return a
sympy
expression of the metabolite’s associated ODE.Will return
None
if metabolite is not associated with aMassReaction
, or0
. if thefixed
attribute is set asTrue
.
- property formula_weight(self)[source]
Calculate and return the formula weight of the metabolite.
Does not consider any moieties enclosed in brackets.
Notes
Overrides
formula_weight()
of thecobra.Metabolite
to allow for the use of moieties.
- property ic(self)[source]
Alias for the
initial_condition
.
- property ode(self)[source]
Alias for the
ordinary_differential_equation
.
- _remove_compartment_from_id_str(self)[source]
Remove the compartment from the ID str of the metabolite.
Warning
This method is intended for internal use only.