mass.io.dict
Module to convert or create mass objects into or from dictionaries.
Converting objects into dictionaries allow for the exportation of
MassModels 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
MassModelinto 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_reactionsattributes 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
MassModelfrom a dictionary.Notes
The
enzyme_module_ligands,enzyme_module_forms, andenzyme_module_reactionsattributes are used to determine whether the model should be initialized as anEnzymeModuleor as aMassModel. At least one of these three attributes must be present in order for anEnzymeModuleto 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
MassMetaboliteinto 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
MassMetabolitefrom a dictionary.Notes
The presence of the
enzyme_module_idattribute is used to determine whether the dictionary should be initialized as anEnzymeModuleFormor 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
MassReactioninto 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
MassReactionfrom a dictionary.Notes
The presence of the
EnzymeModuleReaction.enzyme_module_idattribute is used to determine whether the dictionary should be initialized as anEnzymeModuleReactionor as aMassReaction.- Parameters
- Returns
The generated reaction.
- Return type
See also
- mass.io.dict.enzyme_to_dict(enzyme)[source]
Convert an
EnzymeModuleDictinto 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
EnzymeModuleDictfrom a dictionary.- Parameters
- Returns
The generated enzyme module dictionary.
- Return type
See also
- mass.io.dict.unit_to_dict(unit_definition)[source]
Convert an
UnitDefintioninto 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