Calculating EFMs in a toy model

using ElementaryFluxModes

import AbstractFBCModels as A

Load a simple model

The code used to construct the model is located in test/simple_model.jl, but it is not shown here for brevity.

model

model.reactions
Dict{String, AbstractFBCModels.CanonicalModel.Reaction} with 7 entries:
  "r1"   => Reaction("r1", 0.0, 1000.0, Dict("m1"=>1.0), 0.0, nothing, Dict{String, Vector{String}}(), Dict{String, Vector{String}}())
  "r2"   => Reaction("r2", 0.0, 1000.0, Dict("m2"=>1.0), 0.0, nothing, Dict{String, Vector{String}}(), Dict{String, Vector{String}}())
  "r5"   => Reaction("r5", 0.0, 1000.0, Dict("m2"=>-1.0, "m4"=>1.0), 0.0, [["g3", "g4"]], Dict{String, Vector{String}}(), Dict{String, Vector{String}…
  "ATPM" => Reaction("ATPM", 0.0, 1000.0, Dict("m4"=>-1.0), 0.0, nothing, Dict{String, Vector{String}}(), Dict{String, Vector{String}}())
  "r6"   => Reaction("r6", 0.0, 1000.0, Dict("m4"=>-1.0), 1.0, nothing, Dict{String, Vector{String}}(), Dict{String, Vector{String}}())
  "r3"   => Reaction("r3", 0.0, 1000.0, Dict("m3"=>1.0, "m2"=>-1.0, "m1"=>-1.0), 0.0, [["g1"]], Dict{String, Vector{String}}(), Dict{String, Vector{S…
  "r4"   => Reaction("r4", 0.0, 1000.0, Dict("m3"=>-1.0, "m4"=>1.0), 0.0, [["g2"]], Dict{String, Vector{String}}(), Dict{String, Vector{String}}())

Get the stoichiometric matrix of the model, this is what we use to find EFMs

N = A.stoichiometry(model)
4×7 SparseArrays.SparseMatrixCSC{Float64, Int64} with 11 stored entries:
   ⋅   1.0   ⋅   -1.0    ⋅     ⋅     ⋅ 
   ⋅    ⋅   1.0  -1.0    ⋅   -1.0    ⋅ 
   ⋅    ⋅    ⋅    1.0  -1.0    ⋅     ⋅ 
 -1.0   ⋅    ⋅     ⋅    1.0   1.0  -1.0

Calculate the EFMs

Run the double description algorith on N and K

E = get_efms(Matrix(N))
7×4 Matrix{Float64}:
 1.0  1.0  0.0  0.0
 1.0  0.0  1.0  0.0
 1.0  1.0  1.0  1.0
 1.0  0.0  1.0  0.0
 1.0  0.0  1.0  0.0
 0.0  1.0  0.0  1.0
 0.0  0.0  1.0  1.0

If preferred, we can transform the vector of EFMs, E, into a dictionary of reaction => fluxes through the efms

EFM_dict = Dict(A.reactions(model) .=> eachrow(E))
Dict{String, SubArray{Float64, 1, Matrix{Float64}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}}, true}} with 7 entries:
  "r1"   => [1.0, 0.0, 1.0, 0.0]
  "r2"   => [1.0, 1.0, 1.0, 1.0]
  "r5"   => [0.0, 1.0, 0.0, 1.0]
  "ATPM" => [1.0, 1.0, 0.0, 0.0]
  "r6"   => [0.0, 0.0, 1.0, 1.0]
  "r3"   => [1.0, 0.0, 1.0, 0.0]
  "r4"   => [1.0, 0.0, 1.0, 0.0]

This page was generated using Literate.jl.