Model
class serves as the foundational component for describing biochemical systems in Catalax. It provides a unified framework for defining states, such as molecules, proteins or process variables, as well as reactions, parameters, and constraints that govern system dynamics. Whether you’re modeling simple enzyme kinetics or complex metabolic networks, the Model class offers the flexibility and mathematical rigor needed for advanced computational analysis including simulation, optimization, and Bayesian inference.
Understanding the Model Architecture
Core Components and Structure
The Model class organizes biochemical systems into five main components, each serving a specific purpose in mathematical modeling:- Species: Chemical entities whose concentrations change over time (substrates, products, enzymes, inhibitors)
- ODEs: Differential equations governing the rate of change for each state
- Parameters: Kinetic constants and other model coefficients that characterize system behavior
- Constants: Time-invariant quantities that influence dynamics but don’t change during simulation
- Assignments: Derived quantities calculated from other model components
Mathematical Foundation
The Model class implements systems of ordinary differential equations (ODEs) of the form: where represents the state, contains parameters, represents constants, and is time. This mathematical framework supports a wide range of biochemical phenomena from simple mass action kinetics to complex regulatory mechanisms.Basic Model Construction Workflow
Step 1: Model Instantiation
Begin by creating a model instance with a descriptive name that clearly identifies your biochemical system:Step 2: Species Definition
Add states that participate in your system using flexible syntax options:- Symbols: Short identifiers used in equations (S, E, P)
- Names: Descriptive labels for documentation and visualization
- Consistency: Maintain consistent naming conventions across related models
- Biological meaning: Choose symbols that reflect chemical reality and facilitate interpretation
Step 3a: Reaction Definition
Define the reactions that govern states dynamics by either by providing a reaction scheme or by defining the reactants, products individually:- Automatic parameter inference: Parameters (k_cat, K_m) are automatically detected and added to the model
- Symbolic processing: Equations are converted to SymPy expressions for mathematical manipulation
- Observable states: By default, all states are observable; use
observable=False
for hidden states. In the case of using the scheme method, simply change the arrow to a double arrow to imply reversibility. For instance,S -> P
becomesS <-> P
. - Validation: The system checks for invalid states not yet added to the model.
->
(irreversible)<->
(reversible)=>
(irreversible)<=>
(reversible)<==>
(reversible)<===>
(reversible)>
(irreversible)
Step 3b: ODE Definition
Define the differential equations that govern states dynamics by either using theadd_ode
method or the add_odes
method:
- Automatic parameter inference: Parameters (k_cat, K_m) are automatically detected and added to the model
- Symbolic processing: Equations are converted to SymPy expressions for mathematical manipulation
- Observable states: By default, all states are observable; use
observable=False
for hidden states - Validation: The system checks for invalid states not yet added to the model.
Step 4: Parameter Configuration
Configure model parameters with values, bounds, and constraints:Advanced Model Features
Constants and External Parameters
Define time-invariant quantities that influence system behavior by either using theadd_constant
method or the add_constants
method:
- Environmental conditions: pH, temperature, ionic strength
- Total concentrations: Total enzyme, total substrate pools
- System parameters: Reactor volume, flow rates
Assignment Equations
Create derived quantities that depend on other model components by either using theadd_assignment
method or the add_assignments
method:
- Conservation relationships: Mass balance and stoichiometric constraints
- Derived quantities: Calculated properties for analysis and visualization
- Complex expressions: Multi-parameter relationships and equilibrium definitions
Model Reparameterization
Transform models by substituting symbols with expressions or values:- Model simplification: Fixing well-known parameters
- Sensitivity analysis: Systematic parameter variation
- Model comparison: Testing different mechanistic hypotheses
Simulation and Analysis
Basic Simulation Workflow
Run model simulations using the Dataset interface:Model as Predictor
The Model class implements the Predictor interface, enabling use in analysis workflows:Rate Function Evaluation
Access instantaneous reaction rates for specialized analysis:- Phase plane analysis: Vector field visualization
- Stability analysis: Equilibrium point characterization
- Sensitivity analysis: Gradient-based parameter studies
Model Persistence and Exchange
Saving and Loading Models
Preserve models for reproducible research and collaboration:EnzymeML Integration
Exchange models with the broader biochemical modeling community by using the EnzymeML format. You can either create a new EnzymeML document from the model or update an existing EnzymeML document with the model’s parameters: Method 1: Create a new EnzymeML document from the model- Standards compliance: FAIR data principles and community standards
- Tool interoperability: Exchange with other modeling platforms
- Metadata preservation: Experimental context and provenance information
Best Practices and Guidelines
Follow systematic approaches for robust model development:- Start simple: Begin with minimal mechanisms and add complexity incrementally
- Validate incrementally: Test each addition with simulations and basic analysis
- Document assumptions: Use clear names and comments to explain modeling choices
- Version control: Save model states at key development milestones
- Test reproducibility: Verify that saved/loaded models produce identical results