Unverified Commit 0be294c2 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil 🚴 Committed by GitHub
Browse files

Merge pull request #462 from LCSB-BioCore/mk-screen-in-readme

demonstrate screen() in README
parents f13041f5 f780aee0
Pipeline #48285 failed with stages
in 30 minutes and 18 seconds
......@@ -114,6 +114,97 @@ Dict{String,Float64} with 95 entries:
"R_TALA" => 1.49698
⋮ => ⋮
#### Model variant processing
The main feature of COBREXA.jl is the ability to easily specify and process
many analyses at once, in parallel. Let's see how the organism would perform if
some reactions were disabled:
# convert to a model type that is easy to modify
m = convert(StandardModel, m)
# find the model objective value if oxygen and carbon dioxide transports are disabled
# this specifies how to generate the desired model variants
[], # one with no modifications
[with_changed_bound("O2t", lower=0.0, upper=0.0)], # disable oxygen
[with_changed_bound("CO2t", lower=0.0, upper=0.0)], # disable CO2
[with_changed_bound("O2t", lower=0.0, upper=0.0),
with_changed_bound("CO2t", lower=0.0, upper=0.0)], # disable both
# this specifies what to do with the model variants (received as the argument `x`)
analysis = x ->
flux_balance_analysis_dict(x, Tulip.Optimizer)["BIOMASS_Ecoli_core_w_GAM"],
You should receive a result showing that missing oxygen transport makes the
biomass production much harder:
4-element Vector{Float64}:
Most importantly, such analyses can be easily specified by automatically
generating long lists of the modifications to apply to the model, and
# load the task distribution package, add several worker nodes, and load
# COBREXA and the solver on the nodes
using Distributed
@everywhere using COBREXA, Tulip
# get a list of the workers
worker_list = workers()
# run the processing in parallel for many model variants
res = screen(m,
# create one variant for each reaction in the model, with that reaction knocked out
[with_changed_bound(reaction_id, lower=0.0, upper=0.0)]
for reaction_id in reactions(m)
analysis = model -> begin
# we need to check if the optimizer even found a feasible solution,
# which may not be the case if we knock out important reactions
sol = flux_balance_analysis_dict(model, Tulip.Optimizer)
isnothing(sol) ? nothing : sol["BIOMASS_Ecoli_core_w_GAM"]
# run the screening in parallel on all workers in the list
workers = worker_list,
In result, you should get a long list of the biomass production for each
reaction knockout. Let's decorate it with reaction names:
Dict(reactions(m) .=> res)
...which should output an easily accessible dictionary with all the objective
values named, giving a quick overview of which reactions are critical for the
model organism to create biomass:
Dict{String, Union{Nothing, Float64}} with 95 entries:
"ACALD" => 0.873922
"PTAr" => 0.873922
"ALCD2x" => 0.873922
"PDH" => 0.796696
"PYK" => 0.864926
"CO2t" => 0.46167
"EX_nh4_e" => 1.44677e-15
"MALt2_2" => 0.873922
"CS" => 2.44779e-14
"PGM" => 1.04221e-15
"TKT1" => 0.864759
### Testing the installation
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