corneto.io.parse_cobra_model#

corneto.io.parse_cobra_model(model)#

Parse a COBRA metabolic model and extract its core components.

This function takes a COBRA model and extracts its stoichiometric matrix, reaction data, and metabolite data.

Parameters:

model (CobraModel) – A COBRA model object to import.

Returns:

A tuple containing:

  • S (numpy.ndarray): The stoichiometric matrix.

  • R (numpy.ndarray): A structured numpy array containing reaction data with fields:

    • id (str): Reaction identifier.

    • name (str): Reaction name.

    • lb (float): Lower bound.

    • ub (float): Upper bound.

    • subsystem (str | List[str]): Reaction subsystem(s).

    • gpr (str): Gene-protein-reaction rule.

  • M (numpy.ndarray): A structured numpy array containing metabolite data with fields:

    • id (str): Metabolite identifier.

    • name (str): Metabolite name.

    • formula (str): Chemical formula.

Return type:

Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]

Raises:

ImportError – If COBRApy is not installed.