Commit d7c31b25 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil
Browse files

make a small usage modification so that the function makes sense again

parent 18788488
......@@ -63,6 +63,8 @@ fluxes = flux_balance_analysis_dict(
# and leaving the system through boundary reactions (e.g. exchange reactions),
# based on `fluxes`:
fluxes_without_biomass = copy(fluxes);
delete!(fluxes_without_biomass, "BIOMASS_Ecoli_core_w_GAM");
atom_exchange(model, fluxes)
# ## Inspecting the flux solution: `metabolite_fluxes`
......
"""
atom_exchange(model::MetabolicModel, flux_dict::Dlicict{String, Float64})
atom_exchange(model::MetabolicModel, flux_dict::Dict{String, Float64})
Return a dictionary mapping the flux of atoms across the boundary of the model
given `flux_dict` (the solution of a constraint based analysis) of reactions in `model`.
......@@ -11,6 +11,7 @@ function atom_exchange(model::MetabolicModel, flux_dict::Dict{String,Float64})
atom_flux = Dict{String,Float64}()
for (ridx, rid) in enumerate(rids)
haskey(flux_dict, rid) || continue
rflux = flux_dict[rid]
for (midx, mstoi) in zip(findnz(S[:, ridx])...)
atoms = metabolite_formula(model, mids[midx])
......
......@@ -7,9 +7,13 @@
modifications = [change_objective("BIOMASS_Ecoli_core_w_GAM")],
)
# remove the biomass production from the fluxes, so that there's some atom
# disbalance that can be measured
delete!(fluxes, "BIOMASS_Ecoli_core_w_GAM")
# atom tracker
atom_fluxes = atom_exchange(model, fluxes)
@test isapprox(atom_fluxes["C"], 0; atol = TEST_TOLERANCE)
@test isapprox(atom_fluxes["O"], 0; atol = TEST_TOLERANCE)
@test isapprox(atom_fluxes["N"], 0; atol = TEST_TOLERANCE)
@test isapprox(atom_fluxes["C"], 37.190166489763214; atol = TEST_TOLERANCE)
@test isapprox(atom_fluxes["O"], 41.663071522672226; atol = TEST_TOLERANCE)
@test isapprox(atom_fluxes["N"], 4.765319167566247; atol = TEST_TOLERANCE)
end
Markdown is supported
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