# 17.1.1.2.1.10. cobra.flux_analysis.reaction¶

Provide functions for analyzing / creating objective functions.

## 17.1.1.2.1.10.1. Module Contents¶

### 17.1.1.2.1.10.1.1. Functions¶

 assess(model: Model, reaction: Union[Reaction, str], flux_coefficient_cutoff: float = 0.001, solver: str = None) → Union[bool, Dict] Assess production capacity. assess_component(model: Model, reaction: Union[Reaction, str], side: str, flux_coefficient_cutoff: float = 0.001, solver: str = None) → Union[bool, Dict] Assess production capacity of components. _optimize_or_value(model: Model, value: float = 0.0) → float Perform quick optimization and return the objective value. assess_precursors(model: Model, reaction: Reaction, flux_coefficient_cutoff: float = 0.001, solver: str = None) → Union[bool, Dict] Assess production capacity of precursors. assess_products(model: Model, reaction: Reaction, flux_coefficient_cutoff: float = 0.001, solver: str = None) → Union[bool, Dict] Assesses absorption capacity of products.
cobra.flux_analysis.reaction.assess(model: Model, reaction: Union[Reaction, str], flux_coefficient_cutoff: float = 0.001, solver: str = None) → Union[bool, Dict][source]

Assess production capacity.

Assess the capacity of the model to produce the precursors for the reaction and absorb the production of the reaction while the reaction is operating at, or above, the specified flux_coefficient_cutoff.

Deprecated since version 0.10.0a1: solver argument will be removed in cobrapy 1.0.0, it is replaced by globally setting the solver via cobra.Configuration .

Parameters
• model (cobra.Model) – The cobra model to assess production capacity for.

• reaction (str or cobra.Reaction) – The reaction to assess.

• flux_coefficient_cutoff (float, optional) – The minimum flux that reaction must carry to be considered active (default 0.001).

• solver (str, optional) – The solver name. If None, the default solver will be used (default None).

Returns

True if the model can produce the precursors and absorb the products for the reaction operating at, or above, flux_coefficient_cutoff. Otherwise, a dictionary of {‘precursor’: Status, ‘product’: Status}, where ‘Status’ is the results from assess_precursors and assess_products, respectively.

Return type

bool or dict

cobra.flux_analysis.reaction.assess_component(model: Model, reaction: Union[Reaction, str], side: str, flux_coefficient_cutoff: float = 0.001, solver: str = None) → Union[bool, Dict][source]

Assess production capacity of components.

Assess the ability of the model to provide sufficient precursors, or absorb products, for a reaction operating at, or beyond, the specified flux_coefficient_cutoff.

Deprecated since version 0.10.0a1: solver argument will be removed in cobrapy 1.0.0, it is replaced by globally setting the solver via cobra.Configuration .

Parameters
• model (cobra.Model) – The cobra model to assess production capacity for.

• reaction (str or cobra.Reaction) – The reaction to assess.

• side ({"products", "reactants"}) – The side of the reaction to assess.

• flux_coefficient_cutoff (float, optional) – The minimum flux that reaction must carry to be considered active (default 0.001).

• solver (str, optional) – The solver name. If None, the default solver will be used (default None).

Returns

True if the precursors can be simultaneously produced at the specified cutoff. False, if the model has the capacity to produce each individual precursor at the specified threshold but not all precursors at the required level simultaneously. Otherwise, a dictionary of the required and the produced fluxes for each reactant that is not produced in sufficient quantities.

Return type

bool or dict

cobra.flux_analysis.reaction._optimize_or_value(model: Model, value: float = 0.0) → float[source]

Perform quick optimization and return the objective value.

The objective value is returned at value error value.

Deprecated since version 0.22.0: _optimize_or_value will be removed in cobrapy 1.0.0, its functionality can be achieved by using cobra.Model.slim_optimize.

Parameters
• model (cobra.Model) – The model to optimize.

• value (float) – The error value to consider.

Returns

The optimized value of the model’s objective.

Return type

float

cobra.flux_analysis.reaction.assess_precursors(model: Model, reaction: Reaction, flux_coefficient_cutoff: float = 0.001, solver: str = None) → Union[bool, Dict][source]

Assess production capacity of precursors.

Assess the ability of the model to provide sufficient precursors for a reaction operating at, or beyond, the flux_coefficient_cutoff.

Deprecated since version 0.7.0: assess_precursors will be removed in cobrapy 1.0.0, it is replaced by assess_component.

Parameters
• model (cobra.Model) – The cobra model to assess production capacity for.

• reaction (str or cobra.Reaction) – The reaction to assess.

• flux_coefficient_cutoff (float, optional) – The minimum flux that reaction must carry to be considered active (default 0.001).

• solver (str, optional) – The solver name. If None, the default solver will be used (default None).

Returns

True if the precursors can be simultaneously produced at the specified cutoff. False, if the model has the capacity to produce each individual precursor at the specified threshold but not all precursors at the required level simultaneously. Otherwise, a dictionary of the required and the produced fluxes for each reactant that is not produced in sufficient quantities.

Return type

bool or dict

cobra.flux_analysis.reaction.assess_products(model: Model, reaction: Reaction, flux_coefficient_cutoff: float = 0.001, solver: str = None) → Union[bool, Dict][source]

Assesses absorption capacity of products.

Assess the ability of the model to to absorb the products of a reaction at a given flux rate. Useful for identifying which components might be blocking a reaction from achieving a specific flux rate.

Deprecated since version 0.7.0: assess_products will be removed in cobrapy 1.0.0, it is replaced by assess_component.

Parameters
• model (cobra.Model) – The cobra model to assess production capacity for.

• reaction (str or cobra.Reaction) – The reaction to assess.

• flux_coefficient_cutoff (float, optional) – The minimum flux that reaction must carry to be considered active (default 0.001).

• solver (str, optional) – The solver name. If None, the default solver will be used (default None).

Returns

True if the model has the capacity to absorb all the reaction products being simultaneously given the specified cutoff. False, if the model has the capacity to absorb each individual product but not all products at the required level simultaneously. Otherwise, a dictionary of the required and the capacity fluxes for each product that is not absorbed in sufficient quantities.

Return type

bool or dict