17.1.1.3.1.1. cobra.io.dict
¶
17.1.1.3.1.1.1. Module Contents¶
17.1.1.3.1.1.1.1. Functions¶
|
convert possible types to str, float, and bool |
|
update new_dict with optional attributes from cobra_object |
|
|
|
|
|
|
|
|
|
|
|
|
|
Convert model to a dict. |
|
Build a model from a dict. |
-
cobra.io.dict.
_REQUIRED_REACTION_ATTRIBUTES
= ['id', 'name', 'metabolites', 'lower_bound', 'upper_bound', 'gene_reaction_rule'][source]¶
-
cobra.io.dict.
_ORDERED_OPTIONAL_REACTION_KEYS
= ['objective_coefficient', 'subsystem', 'notes', 'annotation'][source]¶
-
cobra.io.dict.
_ORDERED_OPTIONAL_METABOLITE_KEYS
= ['charge', 'formula', '_bound', 'notes', 'annotation'][source]¶
-
cobra.io.dict.
_ORDERED_OPTIONAL_MODEL_KEYS
= ['name', 'compartments', 'notes', 'annotation'][source]¶
-
cobra.io.dict.
_update_optional
(cobra_object, new_dict, optional_attribute_dict, ordered_keys)[source]¶ update new_dict with optional attributes from cobra_object
-
cobra.io.dict.
model_to_dict
(model, sort=False)[source]¶ Convert model to a dict.
- Parameters
model (cobra.Model) – The model to reformulate as a dict.
sort (bool, optional) – Whether to sort the metabolites, reactions, and genes or maintain the order defined in the model.
- Returns
A dictionary with elements, ‘genes’, ‘compartments’, ‘id’, ‘metabolites’, ‘notes’ and ‘reactions’; where ‘metabolites’, ‘genes’ and ‘metabolites’ are in turn lists with dictionaries holding all attributes to form the corresponding object.
- Return type
OrderedDict
See also
-
cobra.io.dict.
model_from_dict
(obj)[source]¶ Build a model from a dict.
Models stored in json are first formulated as a dict that can be read to cobra model using this function.
- Parameters
obj (dict) – A dictionary with elements, ‘genes’, ‘compartments’, ‘id’, ‘metabolites’, ‘notes’ and ‘reactions’; where ‘metabolites’, ‘genes’ and ‘metabolites’ are in turn lists with dictionaries holding all attributes to form the corresponding object.
- Returns
The generated model.
- Return type
cora.core.Model
See also