Skip to content
/ enzax Public

Differentiable kinetic models of enzyme-catalysed reaction networks

Notifications You must be signed in to change notification settings

dtu-qmcm/enzax

Repository files navigation

Enzax

Tests Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. Supported Python versions: 3.12 and newer Documentation Status

Enzax is a library of automatically differentiable equations and solvers for modelling networks of enzyme-catalysed reactions, written in JAX.

Enzax provides straightforward, fast and interoperable access to the gradients of realistic metabolic network models, allowing you to incorporate these models in your MCMC and machine learning algorithms when you want to, for example, predict the effect of down-regulating an enzyme on the yield of a fermentation experiment.

Installation

pip install enzax

Usage

Find a kinetic model's steady state

from enzax.examples import methionine
from enzax.steady_state import get_kinetic_model_steady_state
from jax import numpy as jnp

guess = jnp.full((5,) 0.01)

steady_state = get_kinetic_model_steady_state(methionine.model, guess)

Find a steady state's Jacobian with respect to all parameters

import jax
from enzax.examples import methionine
from enzax.steady_state import get_kinetic_model_steady_state
from jax import numpy as jnp
from jaxtyping import PyTree

guess = jnp.full((5,) 0.01)
model = methionine.model

def get_steady_state_from_params(parameters: PyTree):
    """Get the steady state with a one-argument non-pure function."""
    _model = RateEquationModel(
        parameters, model.structure, model.rate_equations
    )
    return get_kinetic_model_steady_state(_model, guess)

jacobian = jax.jacrev(get_steady_state_from_params)(model.parameters)