Mayalen Etcheverry
email: mayalen.etcheverry@inria.fr

Michael Levin
email: michael.levin@@tufts.edu

Clément Moulin-Frier
email: clement.moulin-frier@inria.fr

Pierre-Yves Oudeyer
email: pierre-yves.oudeyer@inria.fr

SBMLTOODEJAX: Efficient Simulation and Optimization of Biological Network Models in JAX

Advances in bioengineering and biomedicine demand a deep understanding of the dynamic behavior of biological systems, ranging from protein pathways to complex cellular processes. Biological networks like gene regulatory networks and protein pathways are key drivers of embryogenesis and physiological processes. Comprehending their diverse behaviors is essential for tackling diseases, including cancer, as well as for engineering novel biological constructs. Despite the availability of extensive mathematical models represented in Systems Biology Markup Language (SBML), researchers face significant challenges in exploring the full spectrum of behaviors and optimizing interventions to efficiently shape those behaviors. Existing tools designed for simulation of biological network models are not tailored to facilitate interventions on network dynamics nor to facilitate automated discovery. Leveraging recent developments in machine learning (ML), this paper introduces SBMLTOODEJAX, a lightweight library designed to seamlessly integrate SBML models with ML-supported pipelines, powered by JAX. SBMLTOODEJAX facilitates the reuse and customization of SBML-based models, harnessing JAX's capabilities for efficient parallel simulations and optimization, with the aim to accelerate research in biological network analysis.

Introduction

Developing methods to explore, predict and control the dynamic behavior of biological systems, from protein pathways to complex cellular processes, is an essential frontier of research for bioengineering and biomedicine [START_REF] Kitano | Systems Biology: A Brief Overview[END_REF]. Systems such as gene regulatory networks and protein pathways play pivotal roles in directing embryogenesis, influencing cellular activities, and governing intricate physiological processes. Understanding the range of behaviors that these systems can exhibit is crucial for comprehending and intervening in various disease states, including cancer [START_REF] Singh | Differential gene regulatory networks in development and disease[END_REF][START_REF] Qin | The exploration of disease-specific gene regulatory networks in esophageal carcinoma and stomach adenocarcinoma[END_REF][START_REF] Fazilaty | A gene regulatory network to control EMT programs in development and disease[END_REF], and for the development of novel bioengineered constructs in synthetic morphology contexts [START_REF] Davies | Synthetic morphology via active and agential matter[END_REF][START_REF] Toda | Engineering synthetic morphogen systems that can program multicellular patterning[END_REF][START_REF] Ho | Novel synthetic biology approaches for developmental systems[END_REF].

Thus, significant effort has gone in computational inference and mathematical modeling of biological systems, which has resulted in the development of large collections of publicly-available models, typically stored and exchanged on online platforms (such as the BioModels Database [START_REF] Glont | BioModels: Expanding horizons to include more modelling approaches and formats[END_REF][START_REF] Malik-Sheriff | BioModels-15 years of sharing computational models in life science[END_REF]) using the Systems Biology Markup Language (SBML), a standard format for representing mathematical models of biological systems [START_REF] Hucka | The systems biology markup language (SBML): A medium for representation and exchange of biochemical network models[END_REF][START_REF] Hucka | The Systems Biology Markup Language (SBML): Language Specification for Level 3 Version 2 Core Release 2[END_REF].

Yet, despite the wealth of available SBML models, scientists still lack an in-depth understanding of the range of possible behaviors that these models can exhibit under different initial data and environmental stimuli, and lack effective methods to reveal and optimize those behaviors via external interventions. Except for a set of simple networks where system behavior and response to stimuli can be well understood analytically (or with exhaustive enumeration methods), onerous sampling of the parameter space and time-consuming numerical simulations are needed. This remains a major roadblock for progress in biological network analysis.

On the other hand, recent progress in machine learning (ML) has led to the development of novel computational tools that leverage high-performance computation, parallel execution and differentiable programming and that promise to accelerate research across multiple areas of science, including biological network analysis [START_REF] Muzio | Biological network analysis with deep learning[END_REF] and applications in drug discovery and molecular medicine [START_REF] Camacho | Next-Generation Machine Learning for Biological Networks[END_REF][START_REF] Alquraishi | Differentiable biology: Using deep learning for biophysicsbased and data-driven modeling of molecular mechanisms[END_REF].

However, to our knowledge, there is no software tool that allows seamless integration of existing mathematical models of cellular molecular pathways (SBML files constructed by biologists) with ML-supported pipelines and programming frameworks. Whereas there exists many software tools for manipulation and numerical simulation of SBML models, they typically rely either on specialized simulation platforms limiting the flexibility for customization and scripting (such as COPASI [START_REF] Hoops | COPASI-a COmplex PAthway SImulator[END_REF][START_REF] Bergmann | Copasi/basico: Release 0[END_REF], Virtual Cell [START_REF] Loew | The Virtual Cell: A software environment for computational cell biology[END_REF][START_REF] Slepchenko | Quantitative cell biology with the Cell[END_REF] and Cell Designer [START_REF] Funahashi | CellDesigner: A process diagram editor for gene-regulatory and biochemical networks[END_REF][START_REF] Funahashi | CellDesigner 3.5: A Versatile Modeling Tool for Biochemical Networks[END_REF]) or provide scripting interfaces in Python or Matlab but rely on backend engines that do not support hardware acceleration or automatic differentiation (like Tellurium [START_REF] Choi | Tellurium: An extensible python-based modeling environment for systems and synthetic biology[END_REF][START_REF] Medley | Tellurium notebooks-An environment for reproducible dynamical modeling in systems biology[END_REF] and SBMLtoODEpy [START_REF] Ruggiero | SBMLtoODEpy: A software program for converting SBML models into ODE models in Python[END_REF] Python packages, or the Systems Biology Format Converter (SBFC) which generates MATLAB and OCTAVE code [START_REF] Rodriguez | The systems biology format converter[END_REF]).

In this paper we present SBMLTOODEJAX, a lightweight library that seeks to bridge that gap by bringing SBML simulation to the JAX ecosystem, a thriving community of JAX libraries that aim to accelerate research in machine learning and beyond, with diverse applications spanning molecular dynamics [START_REF] Schoenholz | JAX MD: A Framework for Differentiable Physics[END_REF], protein engineering [START_REF] Ma | Reimplementing Unirep in JAX[END_REF], quantum physics [START_REF] Carleo | NetKet: A machine learning toolkit for many-body quantum systems[END_REF], cosmology [START_REF] Campagne | JAX-COSMO: An End-to-End Differentiable and GPU Accelerated Cosmology Library[END_REF], ocean modeling [START_REF] Häfner | Fast, Cheap, and Turbulent-Global Ocean Modeling With GPU Acceleration in Python[END_REF], photovoltaic research [START_REF] Mann | ∂PV: An end-to-end differentiable solar-cell simulator[END_REF], acoustic simulations [START_REF] Stanziola | J-Wave: An open-source differentiable wave simulator[END_REF] and fluid dynamics [START_REF] Bezgin | JAX-Fluids: A fully-differentiable highorder computational fluid dynamics solver for compressible two-phase flows[END_REF].

SBMLTOODEJAX aims to integrate this ecosystem and provide tools to accelerate research in biological network analysis. In this paper, we explain how SBMLTOODEJAX facilitates the re-use of existing biological network models, as well as their manipulation in Python projects and AI pipelines, while tailoring them to take advantage of JAX main features for efficient and parallel computations.

SBMLTOODEJAX

SBMLTOODEJAX is a lightweight library that allows to automatically parse and convert SBML models into Python models written end-to-end in JAX, a high-performance numerical computing library with automatic differentiation capabilities [START_REF] Bradbury | JAX: Composable transformations of Python+NumPy programs[END_REF]. SBMLTOODEJAX is targeted at researchers that aim to incorporate SBML-specified ordinary differential equation (ODE) models into their pPthon projects and machine learning pipelines, in order to perform efficient numerical simulation and optimization with only a few lines of code.

Taking advantage of JAX's core transformation features, one can easily boost the speed of ODE models time-course simulations and perform efficient search and optimization by running simulations in parallel and/or using automatic differentiation to find derivatives. SBMLTOODEJAX extends SBMLtoODEpy, a Python library developed in 2019 for converting SBML files into Python files written in Numpy/Scipy [START_REF] Ruggiero | SBMLtoODEpy: A software program for converting SBML models into ODE models in Python[END_REF]. The chosen conventions for the generated variables and modules are slightly different from the standard SBML conventions (and from the conventions used in the original SBMLtoODEpy package) with the aim to accommodate for more flexible manipulations while preserving JAX-like functional programming style.

We refer to the documentation available at https://developmentalsystems.org/ sbmltoodejax/ for additional details on SBMLTOODEJAX's design principles, chosen conventions for the generated variables and modules, and full API docs. Various hands-on tutorial notebooks for loading and simulating biomodels, running parallel executions and performing gradient descent optimization with the generated ODE models are also provided.

Why use SBMLTOODEJAX?

Simplicity and extensibility SBMLTOODEJAX retains the simplicity of the SBMLtoODEpy library to facilitate incorporation of the ODE models into one's own Python projects. As shown in Figure 1, with only a few lines of Python code, one can load and simulate existing SBML files. Moreover, one can easily refactor the models to its need.

JAX-friendly

The generated Python models are tailored to take advantage of JAX main features. Model rollouts use jit transformation and scan primitive to reduce compilation and execution time of the recursive ODE integration steps, which is particularly useful when running large numbers of steps (long reaction times). Models also inherit from the Equinox module abstraction [START_REF] Kidger | Equinox: Neural networks in JAX via callable PyTrees and filtered transformations[END_REF] and are registered as PyTree containers, which facilitates the application of JAX core transformations to any SBMLTOODEJAX object.

Efficiency simulation and optimization

The application of JAX core transformations, such as just-in-time compilation (jit), automatic vectorization (vmap) and automatic differentiation (grad), to the generated models make it very easy (and seamless) to efficiently run simulations in parallel. For instance, as shown in Figure 2, with only a few lines of Python code one can vectorize calls to model rollout and perform batched computations, which is especially efficient for large batch sizes. As shown in Figure 3, SBMLTOODEJAX models can also be integrated within Optax pipelines, a gradient processing and optimization library for JAX [START_REF] Babuschkin | The DeepMind JAX Ecosystem[END_REF], allowing to optimize model parameters and/or external interventions with stochastic gradient descent.

Altogether, the parallel execution capabilities and the differentiability of the generated models opens interesting possibilities to design and optimize intervention strategies.

Discussion

The development of SBMLTOODEJAX aims to address the need for efficient integration of Systems Biology Markup Language (SBML) models with machine learning frameworks, particularly the JAX ecosystem. This tool simplifies the utilization of SBML-based models in Python projects and machine learning pipelines, and has the potential to be reused in several contexts at the intersection of machine learning and biology.

As an illustration, SBMLTOODEJAX has been used in a recent publication presenting a novel methodology, using diversity search AI algorithms, for exploring the space of possible behaviors of gene regulatory networks, from the perspective of generic problem-solving agents navigating their environment [START_REF] Etcheverry | Ai-driven automated discovery tools reveal diverse behavioral competencies of biological networks[END_REF]. The authors present several implications that the constructed "behavioral catalogs" could in turn have for biomedicine (control of gene expression via stimuli, not genetic rewiring) and for gene circuit engineering (optimization of network parameters to perform a desired functionality). An interactive version of their paper is available at https://developmentalsystems.org/curious-exploration-of-grn-competencies/.

However, SBMLTOODEJAX is still in its early phase and there are several developments that could be pursued in future work. First, it does not yet handle all possible cases of SBML files, for instance SBML models with events i.e. discrete occurrences that can trigger discontinuous changes in the model. Similarly, SBMLTOODEJAX only integrates one ODE solver for now (jax.experimental.odeint), but could benefit from more [START_REF] Städter | Benchmarking of numerical integration methods for ODE models of biological systems[END_REF]. Finally, whereas SBMLTOOD-EJAX is to our knowledge the first software tool enabling gradient backpropagation through the SBML model rollout, applying it in practice can be hard. GRN models are recurrent networks that are generally run for many steps, with each step calling the ODE solver. This can sometimes lead to gradient issues and long backpropagation compute times. Further optimizing the models to be efficiently differentiable might benefit their broader usage.

Figure 1 :

 1 Figure 1: Example code (left) and output snapshot (right) reproducing original simulation results of Kholodenko 2000's paper [34] hosted on BioModels.

Figure 2 :

 2 Figure 2: (left) Example code to vectorize calls to model rollout (right) Results of a (rudimentary) benchmark comparing the average simulation time of models implemented with SBMLtoODEpy versus SBMLTOODEJAX (for different number of rollouts i.e. batch size). Mean and standarddeviation results of the benchmark, run on 5 models, are displayed. For additional details on the comparison, please refer to our Benchmarking notebook.

Figure 3 :

 3 Figure 3: (left) Example of seamless integration with Optax optimization pipeline, with Adam optimizer, over the model kinematic parameters c of the biomodel #145 which models ATP-induced intracellular calcium oscillations. (right-top) Default simulation results of biomodel #145 and (arbitrary) target sine-wave pattern for Ca_Cyt concentration (shown in light gray). (right-middle) Training loss obtained after running the Optax optimization loop. (right-bottom) Simulation results obtained after optimization where we see that the obtained calcium oscillations (dark gray) align with the target one (light gray). The full example is available at our Gradient Descent tutorial.

tutorials can be found at http://developmentalsystems.org/ sbmltoodejax. Please contact Mayalen