mass.io.dict
Module to convert or create mass
objects into or from dictionaries.
Converting objects into dictionaries allow for the exportation of
MassModel
s in various formats. These formats include:
Module Contents
Functions
|
Convert a |
|
Create a |
|
Convert a |
|
Create a |
|
Convert a |
|
Create a |
|
Convert an |
|
Create an |
|
Convert an |
|
Create an |
- mass.io.dict.model_to_dict(model, sort=False)[source]
Convert a
MassModel
into a serializable dictionary.- Parameters
model (MassModel or EnzymeModule) – The model to represent as a dictionary.
sort (bool) – Whether to sort the metabolites, reactions, genes, and enzyme modules or maintain the order defined in the model. If the model is an
EnzymeModule
, theenzyme_module_ligands
,enzyme_module_forms
, andenzyme_module_reactions
attributes are also included. Default isFalse
.
- Returns
A dictionary with elements corresponding to the model attributes as which are in turn lists containing dictionaries holding all attribute information to form the corresponding object.
- Return type
See also
- mass.io.dict.model_from_dict(obj)[source]
Create a
MassModel
from a dictionary.Notes
The
enzyme_module_ligands
,enzyme_module_forms
, andenzyme_module_reactions
attributes are used to determine whether the model should be initialized as anEnzymeModule
or as aMassModel
. At least one of these three attributes must be present in order for anEnzymeModule
to be created.- Parameters
obj (dict) – A dictionary with elements corresponding to the model attributes as which are in turn lists containing dictionaries holding all attribute information to form the corresponding object.
- Returns
The generated model or enzyme module.
- Return type
See also
- mass.io.dict.metabolite_to_dict(metabolite)[source]
Convert a
MassMetabolite
into a serializable dictionary.- Parameters
metabolite (MassMetabolite) – The metabolite to represent as a dictionary.
- Returns
A dictionary with elements corresponding to metabolite attributes.
- Return type
See also
- mass.io.dict.metabolite_from_dict(metabolite)[source]
Create a
MassMetabolite
from a dictionary.Notes
The presence of the
enzyme_module_id
attribute is used to determine whether the dictionary should be initialized as anEnzymeModuleForm
or as aMassMetabolite
.- Parameters
metabolite (dict) – A dictionary with elements corresponding to the metabolite attributes.
- Returns
The generated metabolite.
- Return type
See also
- mass.io.dict.reaction_to_dict(reaction)[source]
Convert a
MassReaction
into a serializable dictionary.- Parameters
reaction (MassReaction) – The reaction to represent as a dictionary.
- Returns
A dictionary with elements corresponding to reaction attributes.
- Return type
See also
- mass.io.dict.reaction_from_dict(reaction, model)[source]
Create a
MassReaction
from a dictionary.Notes
The presence of the
EnzymeModuleReaction.enzyme_module_id
attribute is used to determine whether the dictionary should be initialized as anEnzymeModuleReaction
or as aMassReaction
.- Parameters
- Returns
The generated reaction.
- Return type
See also
- mass.io.dict.enzyme_to_dict(enzyme)[source]
Convert an
EnzymeModuleDict
into a serializable dictionary.- Parameters
enzyme (EnzymeModuleDict) – The enzyme module to represent as a dictionary.
- Returns
A dictionary with elements corresponding to the enzyme module attributes.
- Return type
See also
- mass.io.dict.enzyme_from_dict(enzyme, model)[source]
Create an
EnzymeModuleDict
from a dictionary.- Parameters
- Returns
The generated enzyme module dictionary.
- Return type
See also
- mass.io.dict.unit_to_dict(unit_definition)[source]
Convert an
UnitDefintion
into a serializable dictionary.- Parameters
unit_definition (UnitDefintion) – The unit definition to represent as a dictionary.
- Returns
A dictionary with elements corresponding to the unit definition attributes.
- Return type
See also