Skip to content

cobra

cobrapy based helper methods.

cobrapy is not a dependency of sbmlutils, it is the optional cobra extra (pip install sbmlutils[cobra]). cobra is None when it is not installed, which is what the tests of this module skip on.

read_cobra_model

read_cobra_model(sbml_path)

Load cobra model from path.

Sets default flux bounds to allow loading and changes all boundaryConditions to False.

:param sbml_path: str path :return: cobra model

cobra_reaction_info

cobra_reaction_info(cobra_model)

Create data frame with bound and objective information.

:param cobra_model: :return: pandas DataFrame

check_mass_balance

check_mass_balance(sbml_path)

Check mass and charge balance of the model.

Parameters:

Name Type Description Default
sbml_path Path

path of the SBML model

required

Returns:

Type Description
dict[str, Any]

The unbalanced reactions, keyed by reaction id.