Getting started

Enzyme Constraint (gecko) models work as regular cobra models with:

  • Proteins as additional metabolites.

  • Protein pseudorreactions, which simulate the production of the protein by the cell.

  • (Optional) Pool constraint: all proteins must be below the total quantified proteome.

The interface mirrors and depends on the cobrapy API.

from os.path import join, pardir

import geckopy

ROOT = pardir
DATA = join(ROOT, "tests", "data")

Import models

The models can be imported directly from SBML. Check the design chapter for more information on how proteins are identified.

ec_model = geckopy.io.read_sbml_ec_model(join(DATA, "eciML1515.xml.gz"))

Model derives from cobra.core.model.

print(f"Model has {len(ec_model.reactions)} reactions and {len(ec_model.metabolites)} metabolites.")
Model has 4824 reactions and 2333 metabolites.

Models can also be written to the SBML file.

geckopy.io.write_sbml_ec_model(ec_model, join(DATA, "model_copy.xml"))

Python API: Protein isolation

Proteins are separated from metabolites and reactions in a different container, proteins.

ec_model.slim_optimize()
0.876997313396373
ec_model.proteins.prot_P0A796
Protein identifierprot_P0A796
Nameprot_P0A796 [cytosol]
Memory address 0x0%x140634108785232
Concentrationnan
Upper bound1000.0
Mw0.0
In 3 reaction(s) PFKNo1 (62.00), PFK_2No1 (62.00), PFK_3No1 (62.00)

Reactions are aware of their proteins.

ec_model.reactions.PFKNo1.proteins
{<Protein prot_P0A796 at 0x7fe7ee18f250>: -4.4803e-06}

Proteins are aware of their reactions.

ec_model.proteins.prot_P0A796.reactions
frozenset({<Reaction PFKNo1 at 0x7fe7ecc97b80>,
           <Reaction PFK_2No1 at 0x7fe7ed25ce20>,
           <Reaction PFK_3No1 at 0x7fe7ed413e50>})

Analogous to autoapi/cobra/index.html#cobra.reaction.flux.

ec_model.proteins.prot_P0A796.contribution
2.7670111370232322e-05

Fluxes are separated in the solution dataframe to avoid regexing:

# Fluxes are separated in the solution dataframe to avoid regexing:
solution_rxn, solution_prot = ec_model.optimize()
solution_rxn
Optimal solution with objective value 0.877
fluxes reduced_costs
EX_acgam_e 0.000000 -2.821258e-01
EX_cellb_e 0.000000 -3.630018e-01
EX_chol_e 0.000000 -2.633174e-02
EX_pi_e 0.000000 0.000000e+00
EX_h_e 8.058201 0.000000e+00
... ... ...
PUACGAMS_REVNo1 0.000000 0.000000e+00
ARHGDx_REVNo1 0.000000 5.312591e-17
UDPGPT_REVNo1 0.000000 -5.551115e-17
4HTHRA_REVNo1 0.000587 0.000000e+00
RHMND_REVNo1 0.000000 0.000000e+00

4824 rows × 2 columns

solution_prot
Optimal solution with objective value 0.877
fluxes reduced_costs
prot_P0A825 4.246198e-07 0.0
prot_P75823 0.000000e+00 -0.0
prot_P0AEA8 0.000000e+00 -0.0
prot_P36553 3.195620e-06 0.0
prot_P06715 1.642762e-07 0.0
... ... ...
prot_P77215 0.000000e+00 -0.0
prot_P0A8Y8 0.000000e+00 -0.0
prot_P76290 0.000000e+00 -0.0
prot_P16691 0.000000e+00 -0.0
prot_P32138 0.000000e+00 -0.0

1259 rows × 2 columns

Kcats

The kcats can be inspected and manipulated from the Protein object, as a regular dictionary.

These kcats are individual for every protein-reaction pair and correspond to the stoichiometric coefficient of the protein pseudometabolite in the reaction.

  • The units of the input are in \(\frac{1}{s}\).

  • This input is translated to \(h\) in the stoichiometric coefficient.

ec_model.proteins.prot_P0A796.kcats
{<Reaction PFKNo1 at 0x7fe7ecc97b80>: 61.99981648054322, <Reaction PFK_2No1 at 0x7fe7ed25ce20>: 61.99981648054322, <Reaction PFK_3No1 at 0x7fe7ed413e50>: 61.99981648054322}
ec_model.proteins.prot_P0A796.kcats["PFKNo1"]
61.99981648054322
ec_model.reactions.PFKNo1.metabolites[ec_model.proteins.prot_P0A796]
-4.4803e-06
ec_model.proteins.prot_P0A796.kcats["PFKNo1"] = 120
ec_model.reactions.PFKNo1.metabolites[ec_model.proteins.prot_P0A796]
-2.3148148148148148e-06