7.1.3. cobrame.io package¶
7.1.3.1. Submodules¶
7.1.3.2. cobrame.io.dict module¶
-
cobrame.io.dict.
get_numeric_from_string
(string)[source]¶ Parameters: string (str) – String representation of numeric expression Returns: Numeric representation of string Return type: float or sympy expression
-
cobrame.io.dict.
get_sympy_expression
(value)[source]¶ Return sympy expression from json string using sympify
mu is assumed to be positive but using sympify does not apply this assumption. The mu symbol produced from sympify is replaced with cobrame’s mu value to ensure the expression can be used in the model.
Parameters: value (str) – String representation of mu containing expression Returns: Numeric representation of string with cobrame’s mu symbol substituted Return type: sympy expression
7.1.3.3. cobrame.io.json module¶
-
cobrame.io.json.
get_schema
()[source]¶ Load JSON schema for ME-model JSON saving/loading
Returns: JSONSCHEMA Return type: dict
-
cobrame.io.json.
load_json_me_model
(file_name)[source]¶ Load a full JSON version of the ME-model. Loading a model in this format will return a ME-model identical to the one saved, which retains all ME-model functionality.
Parameters: file_name (str or file-like object) – Filename of the JSON output or an open json file Returns: A full ME-model Return type: cobrame.core.model.MEModel
-
cobrame.io.json.
load_reduced_json_me_model
(file_name)[source]¶ Load a stripped-down JSON version of the ME-model. This will exclude all of ME-Model information except the reaction stoichiometry information and the reaction bounds. Saving/loading a model in this format will thus occur much quicker, but limit the ability to edit the model and use most of its features.
Parameters: file_name (str or file-like object) – Filename of the JSON ME-model Returns: COBRA Model representation of the ME-model. This will not include all of the functionality of a MEModel
but will solve identically compared to the full model.Return type: cobra.core.model.Model
-
cobrame.io.json.
save_json_me_model
(model, file_name)[source]¶ Save a full JSON version of the ME-model. Saving/loading a model in this format can then be loaded to return a ME-model identical to the one saved, which retains all ME-model functionality.
Parameters: - model (
cobrame.core.model.MEModel
) – A full ME-model - file_name (str or file-like object) – Filename of the JSON output or an open json file
- model (
-
cobrame.io.json.
save_reduced_json_me_model
(me0, file_name)[source]¶ Save a stripped-down JSON version of the ME-model. This will exclude all of ME-Model information except the reaction stoichiometry information and the reaction bounds. Saving/loading a model in this format will thus occur much quicker, but limit the ability to edit the model and use most of its features.
Parameters: - me0 (
cobrame.core.model.MEModel
) – A full ME-model - file_name (str or file-like object) – Filename of the JSON output
- me0 (