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

add more docstrings

parent 3fcc98a1
Pipeline #55279 passed with stages
in 11 minutes and 32 seconds
......@@ -56,7 +56,6 @@ function make_gecko_model(
columns = Vector{_gecko_column}()
coupling_row_reaction = Int[]
coupling_row_gene_product = Int[]
# coupling_row_mass_group = String[]
gids = genes(model)
(lbs, ubs) = bounds(model)
......@@ -146,6 +145,7 @@ function make_gecko_model(
push!(coupling_row_mass_group, (grp, idxs, mms, gmgb_(grp)))
end
# create model with dummy objective
gm = GeckoModel(
spzeros(length(columns) + length(coupling_row_gene_product)),
columns,
......@@ -155,7 +155,10 @@ function make_gecko_model(
model,
)
# set objective (do separately because gene products can also be objectives)
#=
Set objective. This is a separate field because gene products can also be objectives.
This way they can be set as objectives by the user.
=#
gm.objective .= [
_gecko_column_reactions(gm)' * objective(gm.inner)
spzeros(length(coupling_row_gene_product))
......
......@@ -81,7 +81,11 @@ end
"""
objective(model::GeckoModel)
Reconstruct an objective of the [`GeckoModel`](@ref).
Return the objective of the [`GeckoModel`](@ref). Note, the objective is with
respect to the internal variables, i.e. [`reactions(model)`](@ref) and
[`genes(model)`](@ref). To manually set the objective, index into
`model.objective` appropriately, and remember to set the previous coefficients
to zero.
"""
objective(model::GeckoModel) = model.objective
......@@ -90,8 +94,7 @@ objective(model::GeckoModel) = model.objective
Returns the internal reactions in a [`GeckoModel`](@ref) (these may be split
to forward- and reverse-only parts with different isozyme indexes; reactions
IDs are mangled accordingly with suffixes), as well as the genes associated
with enzymatic reactions.
IDs are mangled accordingly with suffixes).
"""
reactions(model::GeckoModel) =
let inner_reactions = reactions(model.inner)
......@@ -107,8 +110,8 @@ reactions(model::GeckoModel) =
"""
n_reactions(model::GeckoModel)
Returns the number of all irreversible reactions in `model` as well as the number of gene products
that take part in enzymatic reactions.
Returns the number of all irreversible reactions in `model` as well as the
number of gene products that take part in enzymatic reactions.
"""
n_reactions(model::GeckoModel) = length(reactions(model))
......@@ -193,7 +196,7 @@ end
"""
balance(model::GeckoModel)
Return the balance of the inner model, concatenated with a vector of
Return the balance of the reactions in the inner model, concatenated with a vector of
zeros representing the enzyme balance of a [`GeckoModel`](@ref).
"""
balance(model::GeckoModel) =
......
......@@ -3,7 +3,8 @@
Return a dictionary mapping protein molar concentrations to their ids. The
argument `opt_model` is a solved optimization problem, typically returned by
[`flux_balance_analysis`](@ref).
[`flux_balance_analysis`](@ref). See [`flux_dict`](@ref) for the corresponding
function that returns a dictionary of solved fluxes.
"""
protein_dict(model::GeckoModel, opt_model) =
is_solved(opt_model) ?
......
......@@ -71,7 +71,7 @@ Compute the part of the coupling for [`GeckoModel`](@ref) that limits the total
mass of each group of gene products.
"""
function _gecko_mass_group_coupling(model::GeckoModel)
tmp = [
tmp = [ # mm = molar mass, mg = mass group, i = row idx, j = col idx
(i, j, mm) for (i, mg) in enumerate(model.coupling_row_mass_group) for
(j, mm) in zip(mg[2], mg[3])
]
......@@ -88,7 +88,8 @@ end
flux_dict(model::GeckoModel, opt_model)
Returns the fluxes (not gene product concentrations) of the model as a
reaction-keyed dictionary, if solved.
reaction-keyed dictionary, if solved. See [`protein_dict`](@ref) for a
function to get the gene product concentrations.
"""
flux_dict(model::GeckoModel, opt_model) =
is_solved(opt_model) ?
......
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