17.1.1.3.2.5. cobra.io.yaml
¶
17.1.1.3.2.5.1. Module Contents¶
17.1.1.3.2.5.1.1. Classes¶
17.1.1.3.2.5.1.2. Functions¶
|
Return the model as a YAML document. |
|
Load a cobra model from a YAML document. |
|
Write the cobra model to a file in YAML format. |
|
Load a cobra model from a file in YAML format. |
-
class
cobra.io.yaml.
MyYAML
(: Any, *, typ: Optional[Text] = None, pure: Any = False, output: Any = None, plug_ins: Any = None)[source]¶ Bases:
ruamel.yaml.main.YAML
-
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
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
model (cobra.Model) – The cobra model to represent.
filename (str or file-like) – File path or descriptor that the YAML representation should be written to.
sort (bool, optional) – Whether to sort the metabolites, reactions, and genes or maintain the order defined in the model.
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
See also
from_yaml()
Load from a string.