index.html 22.1 KB
 Documenter.jl committed May 11, 2021 1   Documenter.jl committed Nov 05, 2021 2 Home · COBREXA.jl
RepositoryTestsCoverageHow to contribute?

COBREXA is a toolkit for working with large constraint-based metabolic models, and running very large numbers of analysis tasks on these models in parallel. Its main purpose is to make the methods of Constraint-based Reconstruction and Analysis (COBRA) scale to problem sizes that require the use of huge computer clusters and HPC environments, which allows them to be realistically applied to pre-exascale-sized models.

In this package, you will find the usual COBRA-like functions that interface to underlying linear programming solvers. We use JuMP.jl as the unified interface for many solvers; you can plug in whichever compatible solver you want, including the popular Tulip.jl, GLPK.jl, OSQP.jl, and Gurobi.jl.

 Documenter.jl committed Feb 08, 2022 8 
 Documenter.jl committed May 11, 2021 9 Development history of COBREXA.jl.  Documenter.jl committed Feb 08, 2022 10 

Quick start guide

You can install COBREXA from Julia repositories. Start julia, press ] to switch to the Packaging environment, and type:

You also need to install your favorite solver supported by JuMP.jl, typing e.g.:

Alternatively, you may use prebuilt Docker and Apptainer images.

When the packages are installed, switch back to the "normal" julia shell by pressing Backspace (the prompt should change color back to green). After that, you can download a SBML model from the internet and perform a flux balance analysis as follows:

using COBREXA   # loads the package 
Documenter.jl committed May 27, 2021  11                                                                                                                                                                                                                                                                                  using Tulip     # loads the optimization solver 
Documenter.jl committed May 11, 2021  12      13      14      15      16      17      18      19                                                                                                                                                                                                                           # download the model download("http://bigg.ucsd.edu/static/models/e_coli_core.xml", "e_coli_core.xml")  # open the SBML file and load the contents model = load_model("e_coli_core.xml")  # run a FBA 
Documenter.jl committed May 27, 2021  20                                                                                                                                                                                                                                                                                  fluxes = flux_balance_analysis_dict(model, Tulip.Optimizer)

The variable fluxes will now contain a dictionary of the computed optimal flux of each reaction in the model:

Dict{String,Float64} with 95 entries: 
Documenter.jl committed May 11, 2021  21      22      23      24      25      26      27      28                                                                                                                                                                                                                            "R_EX_fum_e"    => 0.0   "R_ACONTb"      => 6.00725   "R_TPI"         => 7.47738   "R_SUCOAS"      => -5.06438   "R_GLNS"        => 0.223462   "R_EX_pi_e"     => -3.2149   "R_PPC"         => 2.50431   "R_O2t"         => 21.7995 
Documenter.jl committed May 27, 2021  29                                                                                                                                                                                                                                                                                    "R_G6PDH2r"     => 4.95999 
Documenter.jl committed May 11, 2021  30                                                                                                                                                                                                                                                                                    "R_TALA"        => 1.49698 
Documenter.jl committed Oct 13, 2021  31                                                                                                                                                                                                                                                                                    ⋮               => ⋮

Model variant processing

The main feature of COBREXA.jl is the ability to easily specify and process many analyses in parallel. To demonstrate, let's see how the organism would perform if some reactions were disabled independently:

# convert to a model type that is efficient to modify 
Documenter.jl committed Mar 13, 2022  32                                                                                                                                                                                                                                                                                  m = convert(StandardModel, model) 
Documenter.jl committed Oct 13, 2021  33                                                                                                                                                                                                                                                                                   
Documenter.jl committed Oct 13, 2021  34      35      36      37                                                                                                                                                                                                                                                          # find the model objective value if oxygen or carbon dioxide transports are disabled screen(m, # the base model     variants=[ # this specifies how to generate the desired model variants         [], # one with no modifications, i.e. the base case 
Documenter.jl committed Mar 13, 2022  38      39      40      41                                                                                                                                                                                                                                                                  [with_changed_bound("R_O2t", lower=0.0, upper=0.0)], # disable oxygen         [with_changed_bound("R_CO2t", lower=0.0, upper=0.0)], # disable CO2         [with_changed_bound("R_O2t", lower=0.0, upper=0.0), 	        with_changed_bound("R_CO2t", lower=0.0, upper=0.0)], # disable both 
Documenter.jl committed Oct 13, 2021  42      43      44                                                                                                                                                                                                                                                                      ],     # this specifies what to do with the model variants (received as the argument x)     analysis = x -> 
Documenter.jl committed Mar 13, 2022  45                                                                                                                                                                                                                                                                                          flux_balance_analysis_dict(x, Tulip.Optimizer)["R_BIOMASS_Ecoli_core_w_GAM"], 
Documenter.jl committed Oct 13, 2021  46      47      48      49                                                                                                                                                                                                                                                          )

You should receive a result showing that missing oxygen transport makes the biomass production much harder:

4-element Vector{Float64}:  0.8739215022674809  0.21166294973372796  0.46166961413944896 
Documenter.jl committed Oct 13, 2021  50                                                                                                                                                                                                                                                                                   0.21114065173865457

Most importantly, such analyses can be easily specified by automatically generating long lists of modifications to be applied to the model, and parallelized.

Knocking out each reaction in the model is efficiently accomplished:

# load the task distribution package, add several worker nodes, and load 
Documenter.jl committed Oct 13, 2021  51      52      53      54      55      56      57      58      59      60      61      62      63      64      65      66      67      68      69      70      71      72      73      74      75      76      77      78      79      80      81      82      83      84      85  # COBREXA and the solver on the nodes using Distributed addprocs(4) @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,     variants=[ 	# 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"]     end,     # 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 
Documenter.jl committed May 16, 2022  86                                                                                                                                                                                                                                                                                    ⋮             => ⋮

Basic and quick-start tutorials

Detailed tutorial content is available here.

Detailed listing of advanced tutorials is available here.

Example notebooks and workflows

Detailed notebook content is available here.

Functions reference

Contribution guide

If you wish to contribute code, patches or improvements to COBREXA.jl, please read the basic contribution guidelines and hints..

Acknowledgements

COBREXA.jl is developed at the Luxembourg Centre for Systems Biomedicine of the University of Luxembourg (uni.lu/lcsb), cooperating with the Institute for Quantitative and Theoretical Biology at the Heinrich Heine University in Düsseldorf (qtb.hhu.de).

The development was supported by European Union's Horizon 2020 Programme under PerMedCoE project (permedcoe.eu) agreement no. 951773.