Commit c86064e2 authored by St. Elmo's avatar St. Elmo
Browse files

fixed sampling

parent 67afd6be
......@@ -2,25 +2,25 @@
It is well known that the FBA does not yield a unique solution, i.e. many flux distributions are capable of satisfying the system constraints as well as optimizing the imposed objective function.
Let the feasible space be defined by ``\mathcal{P} = \left\{ v : Sv = 0 \cap v_{\text{min}} \leq v \leq v_{\text{max}} \right\}``.
Sampling methods have been developed to uniformly sample from this feasible solution space.
`CobraTools.jl` implements both `hit_and_run` and `achr` to sample from ``\mathcal{P}``.
`COBREXA.jl` implements both `hit_and_run` and `achr` to sample from ``\mathcal{P}``.
```@docs
hit_and_run
achr
```
```@setup sample
model_location = joinpath("..","..", "models", "e_coli_core.json")
model_location = download("http://bigg.ucsd.edu/static/models/e_coli_core.json", "core.json")
```
```@example sample
using CobraTools
using COBREXA
using JuMP
using Tulip
model = CobraTools.read_model(model_location)
model = read_model(model_location)
optimizer = Tulip.Optimizer
biomass = findfirst(model.reactions, "BIOMASS_Ecoli_core_w_GAM")
cons = Dict("EX_glc__D_e" => (-12.0, -12.0))
sol = fba(model, biomass, optimizer, constraints=cons) # classic flux balance analysis
cons["BIOMASS_Ecoli_core_w_GAM"] = (sol["BIOMASS_Ecoli_core_w_GAM"], sol["BIOMASS_Ecoli_core_w_GAM"]*0.99)
samples = CobraTools.hit_and_run(100_000, model, optimizer; keepevery=10, samplesize=5000, constraints=cons)
samples = hit_and_run(100_000, model, optimizer; keepevery=10, samplesize=5000, constraints=cons)
```
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment