:py:mod:`cobra.medium.boundary_types` ===================================== .. py:module:: cobra.medium.boundary_types .. autoapi-nested-parse:: 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 ~~~~~~~~~ .. autoapisummary:: cobra.medium.boundary_types.find_external_compartment cobra.medium.boundary_types.is_boundary_type cobra.medium.boundary_types.find_boundary_types Attributes ~~~~~~~~~~ .. autoapisummary:: cobra.medium.boundary_types.logger .. py:data:: logger .. py:function:: find_external_compartment(model: cobra.Model) -> str Find the external compartment in the model. Uses a simple heuristic where the external compartment should be the one with the most exchange reactions. :param model: The cobra model whose external compartments are to be identified. :type model: cobra.Model :returns: The putative external compartment. :rtype: str :raises RuntimeError: If several compartments are similar and thus difficult to identify, or, recognized names usually used for external compartment are absent. .. py:function:: is_boundary_type(reaction: cobra.Reaction, boundary_type: str, external_compartment: str) -> bool Check whether a reaction is an exchange reaction. :param reaction: The reaction to check. :type reaction: cobra.Reaction :param boundary_type: Boundary type to check for. :type boundary_type: {"exchange", "demand", "sink"} :param external_compartment: The ID for the external compartment. :type external_compartment: str :returns: Whether the reaction looks like the requested type. Might be based on a heuristic. :rtype: bool .. py:function:: find_boundary_types(model: cobra.Model, boundary_type: str, external_compartment: Optional[str] = None) -> List[cobra.Reaction] Find specific boundary reactions. :param model: The cobra model whose boundary reactions are to be found. :type model: cobra.Model :param boundary_type: Boundary type to check for. :type boundary_type: {"exchange", "demand", "sink"} :param external_compartment: The ID for the external compartment. If None, it will be detected automatically (default None). :type external_compartment: str, optional :returns: A list of likely boundary reactions of a user defined type. :rtype: list of cobra.Reaction or an empty list