Function kair::flux_analysis::fva[][src]

pub fn fva<S>(
    model: &mut ModelLp,
    solver: S,
    reactions: &[String]
) -> Result<HashMap<String, (f64, f64)>, Box<dyn Error>> where
    S: StaticSolver + Clone + Send + Sync

Perform Flux Variability Analysis.

  1. FBA for the default objective and fix its flux to that solution.
  2. For each reaction:
    1. Minimise a FBA with the reaction as objective.
    2. Maximize a FBA with reaction as objective.
  3. Report solution.

The returned HashMap<String, (f64, f64) contains the reaction id as key and a tuple of the lower possible flux and the upper possible flux, respectively.

Example

use kair::{ModelLp, flux_analysis::fva};
use std::{str::FromStr, convert::Into};
use good_lp::default_solver;


// contents is a &str containing a SBML document
let mut model = ModelLp::from_str(&contents).unwrap();
let reactions = &model.  reactions.iter().map(|(k, _v)| k.clone()).collect::<Vec<String>>();
println!("Reaction  LowerFlux  UpperFlux\n{:?}", fva(
    &mut model,
    default_solver,
    reactions,
).unwrap())