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
AbstractFBCModels.CanonicalModel.Model(
  reactions = Dict{String, AbstractFBCModels.CanonicalModel.Reaction}("r1" => AbstractFBCModels.CanonicalModel.Reaction("r1", 0.0, 1000.0, Dict("m1" …
  metabolites = Dict{String, AbstractFBCModels.CanonicalModel.Metabolite}("m3" => AbstractFBCModels.CanonicalModel.Metabolite("m3", nothing, nothing,…
  genes = Dict{String, AbstractFBCModels.CanonicalModel.Gene}("g4" => AbstractFBCModels.CanonicalModel.Gene("g4", Dict{String, Vector{String}}(), Dic…
  couplings = Dict{String, AbstractFBCModels.CanonicalModel.Coupling}(),
)

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

N = A.stoichiometry(model)
4×6 SparseArrays.SparseMatrixCSC{Float64, Int64} with 10 stored entries:
 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))
6×2 Matrix{Float64}:
 1.0  0.0
 1.0  1.0
 1.0  0.0
 1.0  0.0
 0.0  1.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 6 entries:
  "r1" => [1.0, 0.0]
  "r2" => [1.0, 1.0]
  "r5" => [0.0, 1.0]
  "r6" => [1.0, 1.0]
  "r3" => [1.0, 0.0]
  "r4" => [1.0, 0.0]

This page was generated using Literate.jl.