enzymeml/
lib.rs

1//! EnzymeML Rust Library
2//!
3//! This library provides functionality for working with EnzymeML documents, including:
4//!
5//! - Simulating enzyme kinetics through ODE systems
6//! - Optimizing kinetic parameters
7//! - Bayesian parameter estimation
8//! - Profile likelihood computation
9//! - Identifiability analysis
10//! - Language model integration
11//! - SBML format reading and writing
12//! - Tabular data handling
13//! - Plotting and visualization
14//! - Validating EnzymeML documents
15
16#![warn(unused_imports)]
17
18/// EnzymeML version management and schema definitions
19pub mod versions {
20    pub use crate::versions::v2 as latest;
21    /// EnzymeML version 2 schema and data structures
22    pub mod v2;
23}
24
25/// Utility functions
26pub mod utils;
27
28/// Commonly used types and functionality re-exported for convenience
29pub mod prelude {
30    pub use crate::io::*;
31    pub use crate::versions::latest::*;
32
33    #[cfg(feature = "simulation")]
34    pub use crate::simulation::init_cond::*;
35    #[cfg(feature = "simulation")]
36    pub use crate::simulation::output::*;
37    #[cfg(feature = "simulation")]
38    pub use crate::simulation::result::*;
39    #[cfg(feature = "simulation")]
40    pub use crate::simulation::setup::*;
41    #[cfg(feature = "simulation")]
42    pub use crate::simulation::system::*;
43
44    #[cfg(feature = "optimization")]
45    pub use crate::objective::loss::*;
46    #[cfg(feature = "optimization")]
47    pub use crate::objective::objfun::*;
48    #[cfg(feature = "optimization")]
49    pub use crate::optim::*;
50}
51
52/// Core equation handling and manipulation
53pub mod equation;
54
55/// Simulation functionality for enzyme kinetics
56#[cfg(feature = "simulation")]
57pub mod simulation {
58    pub use crate::simulation::setup::SimulationSetup;
59    pub use peroxide::fuga::{
60        ImplicitSolver, BS23, DP45, GL4, RALS3, RALS4, RK4, RK5, RKF45, TSIT45,
61    };
62
63    /// Error types for simulation failures
64    pub mod error;
65    /// Initial condition handling for simulations
66    pub mod init_cond;
67    /// Interpolation functionality
68    pub mod interpolation;
69    /// Output formats for simulation results
70    pub mod output;
71    /// Simulation result data structures
72    pub mod result;
73    /// Simulation setup and configuration
74    pub mod setup;
75    /// Derivation of the stoichiometry matrix
76    pub mod stoich;
77    /// Core ODE system implementation
78    pub mod system;
79    /// Macros for creating JIT functions
80    #[macro_use]
81    pub mod macros;
82}
83
84/// Optimization algorithms and parameter estimation for enzyme kinetics
85#[cfg(feature = "optimization")]
86pub mod optim {
87    pub use crate::optim::bound::*;
88    pub use crate::optim::error::*;
89    pub use crate::optim::optimizers::*;
90    pub use crate::optim::problem::*;
91    pub use crate::optim::transformation::*;
92    pub use argmin::core::CostFunction;
93    pub use argmin::core::Gradient;
94    use argmin_math as _;
95    pub use peroxide::fuga::{
96        ImplicitSolver, BS23, DP45, GL4, RALS3, RALS4, RK4, RK5, RKF45, TSIT45,
97    };
98
99    /// Parameter bounds and constraints for optimization
100    pub mod bound;
101    /// Error types for optimization failures
102    pub mod error;
103    /// Performance metrics and convergence criteria
104    pub mod metrics;
105    /// Observer patterns for monitoring optimization progress
106    pub mod observer;
107    /// Problem formulation and setup for optimization tasks
108    pub mod problem;
109    /// Result reporting and analysis for optimization runs
110    pub mod report;
111    /// System dynamics and equation handling for optimization
112    pub mod system;
113    /// Parameter transformations for optimization algorithms
114    pub mod transformation;
115
116    /// Collection of optimization algorithms and solvers
117    pub mod optimizers {
118        pub use crate::optim::optimizers::bfgs::*;
119        pub use crate::optim::optimizers::ego::*;
120        pub use crate::optim::optimizers::lbfgs::*;
121        pub use crate::optim::optimizers::optimizer::*;
122        pub use crate::optim::optimizers::pso::*;
123        pub use crate::optim::optimizers::srtrust::*;
124        /// Broyden-Fletcher-Goldfarb-Shanno optimization algorithm
125        pub mod bfgs;
126        /// Efficient Global Optimization using Gaussian processes
127        pub mod ego;
128        /// Limited-memory BFGS optimization algorithm
129        pub mod lbfgs;
130        /// Common optimizer traits and interfaces
131        pub mod optimizer;
132        /// Particle Swarm Optimization algorithm
133        pub mod pso;
134        /// Stochastic Rust Trust region optimization algorithm
135        pub mod srtrust;
136        /// Utility functions for optimization algorithms
137        pub(crate) mod utils;
138    }
139}
140
141/// Markov Chain Monte Carlo sampling for Bayesian parameter estimation
142#[cfg(feature = "optimization")]
143pub mod mcmc {
144    /// Diagnostic tools for MCMC chain quality assessment
145    pub mod diagnostics;
146    /// Error types for MCMC sampling failures
147    pub mod error;
148    /// Likelihood function definitions for Bayesian inference
149    pub mod likelihood;
150    /// Output formatting and storage for MCMC results
151    pub mod output;
152    /// Prior distribution specifications for Bayesian analysis
153    pub mod priors;
154    /// Problem setup and configuration for MCMC sampling
155    pub mod problem;
156}
157
158/// Objective function definitions and loss calculations for optimization
159#[cfg(feature = "optimization")]
160pub mod objective {
161    pub use crate::objective::loss::*;
162    pub use crate::objective::objfun::*;
163
164    /// Error types for objective function evaluation failures
165    pub mod error;
166    /// Loss function definitions and implementations
167    pub mod loss;
168    /// Objective function construction and evaluation
169    pub mod objfun;
170}
171
172/// SBML format reading and writing functionality for EnzymeML documents
173#[cfg(feature = "sbml")]
174pub mod sbml {
175    pub use crate::sbml::reader as sbml_reader;
176    pub use crate::sbml::version::EnzymeMLVersion;
177    pub use crate::sbml::writer as sbml_writer;
178
179    /// Annotation handling for SBML metadata
180    pub(crate) mod annotations;
181    /// Error types for SBML processing failures
182    pub mod error;
183    /// SBML document reading and parsing functionality
184    pub mod reader;
185    /// Species type definitions and handling
186    pub(super) mod speciestype;
187    /// Unit handling and conversion for SBML
188    pub(super) mod units;
189    /// Utility functions for SBML processing
190    pub(super) mod utils;
191    /// Version detection and handling for EnzymeML formats
192    pub mod version;
193    /// SBML document writing and serialization functionality
194    pub mod writer;
195    /// EnzymeML version 1 support and schema definitions
196    pub(super) mod v1 {
197        pub(crate) use crate::sbml::v1::schema::*;
198        /// Data extraction utilities for v1 format
199        pub(crate) mod extract;
200        /// Schema definitions for EnzymeML v1
201        pub(super) mod schema;
202        /// Serialization utilities for v1 format
203        pub mod serializer;
204    }
205    /// EnzymeML version 2 support and schema definitions
206    pub(super) mod v2 {
207        pub(crate) use crate::sbml::v2::schema::*;
208        /// Data extraction utilities for v2 format
209        pub(super) mod extract;
210        /// Schema definitions for EnzymeML v2
211        pub(super) mod schema;
212        /// Serialization utilities for v2 format
213        pub mod serializer;
214    }
215}
216
217/// Parameter identifiability analysis and profile likelihood computation
218#[cfg(feature = "optimization")]
219pub mod identifiability {
220    pub use crate::identifiability::egoprofile::*;
221    pub use crate::identifiability::parameter::*;
222    pub use crate::identifiability::profile::*;
223
224    /// Efficient Global Optimization for profile likelihood computation
225    pub mod egoprofile;
226    /// Grid-based parameter space exploration
227    pub mod grid;
228    /// Parameter definition and handling for identifiability analysis
229    pub mod parameter;
230    /// Profile likelihood computation and analysis
231    pub mod profile;
232    /// Result storage and analysis for identifiability studies
233    pub mod results;
234    /// Utility functions for identifiability analysis
235    pub mod utils;
236}
237
238#[cfg(feature = "llm")]
239/// Language model integration for automated EnzymeML document generation and analysis
240pub mod llm;
241
242/// Validation of EnzymeML documents and components
243pub mod validation {
244    pub use crate::validation::schema::*;
245    /// Main consistency interface
246    pub mod consistency;
247    /// Validation of equation specifications
248    mod equations;
249    /// Validation of measurement data
250    mod measurements;
251    /// Validation of kinetic parameters
252    mod parameters;
253    /// Validation of reaction specifications
254    mod reactions;
255    /// Main schema validation interface
256    pub mod schema;
257}
258
259/// Procedural and helper macros
260pub mod macros {
261    /// Macros for reaction specifications
262    #[macro_use]
263    pub mod reaction_macro;
264    /// Macros for data extraction
265    #[macro_use]
266    pub mod extract_macro;
267    /// Macros for unit handling
268    #[macro_use]
269    pub mod unit_macro;
270    /// Utility macros for unwrapping nested data
271    #[macro_use]
272    pub mod unwrap_list;
273    /// Unit conversion and mapping utilities
274    pub mod unit_maps;
275}
276
277/// Language bindings and interfaces for other programming environments
278pub mod bindings {
279    /// WebAssembly bindings for browser and Node.js environments
280    #[cfg(feature = "wasm")]
281    pub mod wasm;
282}
283
284/// Tabular data handling
285#[cfg(feature = "tabular")]
286pub mod tabular {
287    /// DataFrame implementation
288    mod dataframe;
289    /// Reading tabular data from files
290    pub mod reader;
291    /// Writing data to tabular formats
292    pub mod writer;
293}
294
295/// Plotting and visualization functionality
296pub mod plotting;
297
298/// IO functionality
299pub mod io;
300
301/// [`Display`] implementation for the EnzymeML library
302pub mod info;
303
304/// ODE functionality used to derive the system of ODEs from the EnzymeML reactions
305pub mod system;
306
307/// Conversion functionality
308pub mod conversion;
309
310/// EnzymeML Suite
311pub mod suite;