15.1.1.3.1.6. cobra.io.yaml
¶
15.1.1.3.1.6.1. Module Contents¶
-
cobra.io.yaml.
to_yaml
(model, sort=False, **kwargs)[source]¶ Return the model as a YAML document.
kwargs
are passed on toyaml.dump
.Parameters: - model (cobra.Model) – The cobra model to represent.
- sort (bool, optional) – Whether to sort the metabolites, reactions, and genes or maintain the order defined in the model.
Returns: String representation of the cobra model as a YAML document.
Return type: See also
save_yaml_model()
- Write directly to a file.
ruamel.yaml.dump()
- Base function.
-
cobra.io.yaml.
from_yaml
(document)[source]¶ Load a cobra model from a YAML document.
Parameters: document (str) – The YAML document representation of a cobra model. Returns: The cobra model as represented in the YAML document. Return type: cobra.Model See also
load_yaml_model()
- Load directly from a file.
-
cobra.io.yaml.
save_yaml_model
(model, filename, sort=False, **kwargs)[source]¶ Write the cobra model to a file in YAML format.
kwargs
are passed on toyaml.dump
.Parameters: See also
to_yaml()
- Return a string representation.
ruamel.yaml.dump()
- Base function.
-
cobra.io.yaml.
load_yaml_model
(filename)[source]¶ Load a cobra model from a file in YAML format.
Parameters: filename (str or file-like) – File path or descriptor that contains the YAML document describing the cobra model. Returns: The cobra model as represented in the YAML document. Return type: cobra.Model See also
from_yaml()
- Load from a string.