Unverified Commit b027b2db authored by St. Elmo's avatar St. Elmo
Browse files

more comments

parent efdd9fb1
Pipeline #55315 passed with stages
in 14 minutes and 36 seconds
......@@ -55,7 +55,7 @@ function make_gecko_model(
(grp -> gene_product_mass_group_bound[grp])
# ...it would be nicer to have an overload for this, but kwargs can't be used for dispatch
columns = Vector{_gecko_column}()
columns = Vector{_gecko_reaction_column}()
coupling_row_reaction = Int[]
coupling_row_gene_product = Int[]
......@@ -69,7 +69,7 @@ function make_gecko_model(
for i = 1:n_reactions(model)
isozymes = ris_(rids[i])
if isempty(isozymes)
push!(columns, _gecko_column(i, 0, 0, 0, lbs[i], ubs[i], []))
push!(columns, _gecko_reaction_column(i, 0, 0, 0, lbs[i], ubs[i], []))
continue
end
......@@ -115,7 +115,7 @@ function make_gecko_model(
# make a new column
push!(
columns,
_gecko_column(
_gecko_reaction_column(
i,
iidx,
dir,
......@@ -162,7 +162,7 @@ function make_gecko_model(
This way they can be set as objectives by the user.
=#
gm.objective .= [
_gecko_column_reactions(gm)' * objective(gm.inner)
_gecko_reaction_column_reactions(gm)' * objective(gm.inner)
spzeros(length(coupling_row_gene_product))
]
......
"""
struct _gecko_column
struct _gecko_reaction_column
A helper type for describing the contents of [`GeckoModel`](@ref)s.
"""
struct _gecko_column
struct _gecko_reaction_column
reaction_idx::Int
isozyme_idx::Int
direction::Int
......@@ -55,7 +55,10 @@ The structure contains fields `columns` that describe the contents of the
coupling columns, `coupling_row_reaction`, `coupling_row_gene_product` and
`coupling_row_mass_group` that describe correspondence of the coupling rows to
original model and determine the coupling bounds, and `inner`, which is the
original wrapped model.
original wrapped model. Note, `objective` is the objective vector of the model,
special care needs to be taken to ensure that its length is `n_reactions(model)
+ n_genes(model)` when the user modifies it, where `model` is the GeckoModel in
question.
Implementation exposes the split reactions (available as `reactions(model)`),
but retains the original "simple" reactions accessible by [`fluxes`](@ref). All
......@@ -65,7 +68,7 @@ purely virtual and do not occur in [`metabolites`](@ref).
"""
struct GeckoModel <: ModelWrapper
objective::SparseVec
columns::Vector{_gecko_column}
columns::Vector{_gecko_reaction_column}
coupling_row_reaction::Vector{Int}
coupling_row_gene_product::Vector{Tuple{Int,Tuple{Float64,Float64}}}
coupling_row_mass_group::Vector{_gecko_capacity}
......@@ -83,7 +86,7 @@ split into unidirectional forward and reverse ones, each of which may have
multiple variants per isozyme.
"""
function stoichiometry(model::GeckoModel)
irrevS = stoichiometry(model.inner) * COBREXA._gecko_column_reactions(model)
irrevS = stoichiometry(model.inner) * COBREXA._gecko_reaction_column_reactions(model)
enzS = COBREXA._gecko_gene_product_coupling(model)
[
irrevS spzeros(size(irrevS, 1), size(enzS, 1))
......@@ -152,7 +155,7 @@ Get the mapping of the reaction rates in [`GeckoModel`](@ref) to the original
fluxes in the wrapped model.
"""
function reaction_flux(model::GeckoModel)
rxnmat = _gecko_column_reactions(model)' * reaction_flux(model.inner)
rxnmat = _gecko_reaction_column_reactions(model)' * reaction_flux(model.inner)
[
rxnmat
spzeros(n_genes(model), size(rxnmat, 2))
......@@ -167,7 +170,7 @@ wrapped model, coupling for split (arm) reactions, and the coupling for the tota
enzyme capacity.
"""
function coupling(model::GeckoModel)
innerC = coupling(model.inner) * _gecko_column_reactions(model)
innerC = coupling(model.inner) * _gecko_reaction_column_reactions(model)
rxnC = _gecko_reaction_coupling(model)
enzcap = _gecko_mass_group_coupling(model)
[
......
......@@ -10,12 +10,12 @@ _gecko_reaction_name(original_name::String, direction::Int, isozyme_idx::Int) =
"$original_name#reverse#$isozyme_idx"
"""
_gecko_column_reactions(model::GeckoModel)
_gecko_reaction_column_reactions(model::GeckoModel)
Retrieve a utility mapping between reactions and split reactions; rows
correspond to "original" reactions, columns correspond to "split" reactions.
"""
_gecko_column_reactions(model::GeckoModel) = sparse(
_gecko_reaction_column_reactions(model::GeckoModel) = sparse(
[col.reaction_idx for col in model.columns],
1:length(model.columns),
[col.direction >= 0 ? 1 : -1 for col in model.columns],
......
......@@ -155,7 +155,7 @@ const reaction_standard_gibbs_free_energies = Dict{String,Float64}(
"FUM" => -3.424133018702122,
)
const ecoli_core_protein_masses = Dict{String,Float64}(
const ecoli_core_gene_product_masses = Dict{String,Float64}(
#=
Data downloaded from Uniprot for E. coli K12,
gene mass in kDa. To obtain these data yourself, go to
......
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