KAIr (COBRA Alternative In rust)
COnstraint-Based Reconstruction and Analysis (COBRA) methods enable the use of knowledge-based reconstructions of the metabolism of a particular organism to simulate its metabolic network.
kair provides the translation from a SBML (using rust_sbml) document to the most basic
Linear Programming formulation of COBRA: Flux Balance Analysis (FBA). Being
f(z) a function to optimize (historically, the biomass pseudoreaction or the ATPase),
S and stoichimetry matrix; and v the flux vector representing
the reactions in the reconstruction:
The FBA problem can then be optimized thanks to lp_modeler.
See What is flux balance analysis?, Orth et al., 2010 for a brief description of FBA.
Example
Add kair it to your Cargo.toml:
[]
= "0.1.0"
Some use statements to get started.
use ModelLP;
use FromStr;
First, read the SBML document, we will be using the e_coli_core model.
let file_str = read_to_string.unwrap;
let model = from_str.unwrap;
Having read the document, the LP problem is already formulated. We can print some information about it:
println!;
println!;
Output
Model has 144 constraints
Model has 95 variables
Finally, we can optimize it and print the solution, which is just a HashMap of pairs variable name -> solution value.
for in model.optimize.unwrap.iter
Output
R_EX_co2_e_ = 22.809834
R_ATPM_ = 8.39
R_H2Ot_ = -29.175827
R_GLNS_ = 0.22346173
...
R_BIOMASS_Ecoli_core_w_GAM_ = 0.8739215
...
R_EX_pi_e_ = -3.214895
R_SUCOAS_ = -5.064376
R_PGL_ = 4.959985
R_TKT1_ = 1.4969838
To run this example, on the root of this repository, run
cargo run --example ecoli