cobra.medium.boundary_types
¶
Provide functions to identify the type of boundary reactions.
This module uses various heuristics to decide whether a boundary reaction is an exchange, demand or sink reaction. It mostly orientates on the following paper:
Thiele, I., & Palsson, B. Ø. (2010, January). A protocol for generating a high-quality genome-scale metabolic reconstruction. Nature protocols. Nature Publishing Group. http://doi.org/10.1038/nprot.2009.203
Module Contents¶
Functions¶
|
Find the external compartment in the model. |
|
Check whether a reaction is an exchange reaction. |
|
Find specific boundary reactions. |
Attributes¶
- cobra.medium.boundary_types.find_external_compartment(model: cobra.Model) str [source]¶
Find the external compartment in the model.
Uses a simple heuristic where the external compartment should be the one with the most exchange reactions.
- Parameters
model (cobra.Model) – The cobra model whose external compartments are to be identified.
- Returns
The putative external compartment.
- Return type
- Raises
RuntimeError – If several compartments are similar and thus difficult to identify, or, recognized names usually used for external compartment are absent.
- cobra.medium.boundary_types.is_boundary_type(reaction: cobra.Reaction, boundary_type: str, external_compartment: str) bool [source]¶
Check whether a reaction is an exchange reaction.
- Parameters
reaction (cobra.Reaction) – The reaction to check.
boundary_type ({"exchange", "demand", "sink"}) – Boundary type to check for.
external_compartment (str) – The ID for the external compartment.
- Returns
Whether the reaction looks like the requested type. Might be based on a heuristic.
- Return type
- cobra.medium.boundary_types.find_boundary_types(model: cobra.Model, boundary_type: str, external_compartment: Optional[str] = None) List[cobra.Reaction] [source]¶
Find specific boundary reactions.
- Parameters
model (cobra.Model) – The cobra model whose boundary reactions are to be found.
boundary_type ({"exchange", "demand", "sink"}) – Boundary type to check for.
external_compartment (str, optional) – The ID for the external compartment. If None, it will be detected automatically (default None).
- Returns
A list of likely boundary reactions of a user defined type.
- Return type
list of cobra.Reaction or an empty list