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

format

parent 5c6c4f92
Pipeline #55275 failed with stages
in 10 minutes and 20 seconds
......@@ -130,7 +130,7 @@ function make_gecko_model(
end
# prepare enzyme capacity constraints
mg_gid_lookup = Dict{String, Vector{String}}()
mg_gid_lookup = Dict{String,Vector{String}}()
for gid in gids[coupling_row_gene_product]
mg = gmg_(gid)
if haskey(mg_gid_lookup, mg)
......@@ -139,7 +139,7 @@ function make_gecko_model(
mg_gid_lookup[mg] = [gid]
end
end
coupling_row_mass_group = Vector{Tuple{String, Vector{Int}, Vector{Float64}, Float64}}()
coupling_row_mass_group = Vector{Tuple{String,Vector{Int},Vector{Float64},Float64}}()
for (grp, gs) in mg_gid_lookup
idxs = [gene_row_lookup[x] for x in Int.(indexin(gs, gids))]
mms = gpmm_.(gs)
......
......@@ -31,7 +31,8 @@ function make_smoment_model(
total_enzyme_capacity::Float64,
)
ris_ =
reaction_isozyme isa Function ? reaction_isozyme : (rid -> get(reaction_isozyme, rid, nothing))
reaction_isozyme isa Function ? reaction_isozyme :
(rid -> get(reaction_isozyme, rid, nothing))
gpmm_ =
gene_product_molar_mass isa Function ? gene_product_molar_mass :
(gid -> gene_product_molar_mass[gid])
......
......@@ -55,7 +55,7 @@ struct GeckoModel <: ModelWrapper
columns::Vector{_gecko_column}
coupling_row_reaction::Vector{Int}
coupling_row_gene_product::Vector{Tuple{Int,Tuple{Float64,Float64}}}
coupling_row_mass_group::Vector{Tuple{String, Vector{Int}, Vector{Float64}, Float64}}
coupling_row_mass_group::Vector{Tuple{String,Vector{Int},Vector{Float64},Float64}}
inner::MetabolicModel
end
......@@ -93,7 +93,7 @@ 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.
"""
reactions(model::GeckoModel) =
reactions(model::GeckoModel) =
let inner_reactions = reactions(model.inner)
[
_gecko_reaction_name(
......@@ -135,7 +135,8 @@ end
Get the mapping of the reaction rates in [`GeckoModel`](@ref) to the original
fluxes in the wrapped model.
"""
reaction_flux(model::GeckoModel) = _gecko_column_reactions(model)' * reaction_flux(model.inner)
reaction_flux(model::GeckoModel) =
_gecko_column_reactions(model)' * reaction_flux(model.inner)
"""
coupling(model::GeckoModel)
......@@ -146,13 +147,13 @@ enzyme capacity.
"""
function coupling(model::GeckoModel)
innerC = coupling(model.inner) * _gecko_column_reactions(model)
rxnC = _gecko_reaction_coupling(model)
rxnC = _gecko_reaction_coupling(model)
enzcap = _gecko_mass_group_coupling(model)
[
innerC spzeros(size(innerC, 1), n_genes(model))
rxnC spzeros(size(rxnC, 1), n_genes(model))
spzeros(length(model.coupling_row_mass_group), length(model.columns)) enzcap
]
]
end
"""
......@@ -195,7 +196,8 @@ end
Return the balance of the inner model, concatenated with a vector of
zeros representing the enzyme balance of a [`GeckoModel`](@ref).
"""
balance(model::GeckoModel) = [balance(model.inner); spzeros(length(model.coupling_row_gene_product))]
balance(model::GeckoModel) =
[balance(model.inner); spzeros(length(model.coupling_row_gene_product))]
"""
n_genes(model::GeckoModel)
......@@ -209,18 +211,19 @@ n_genes(model::GeckoModel) = length(genes(model))
Return the gene ids of genes that have enzymatic constraints associated with them.
"""
genes(model::GeckoModel) = genes(model.inner)[[idx for (idx, _) in model.coupling_row_gene_product]]
genes(model::GeckoModel) =
genes(model.inner)[[idx for (idx, _) in model.coupling_row_gene_product]]
"""
metabolites(model::GeckoModel)
Return the ids of all metabolites, both real and pseudo, for a [`GeckoModel`](@ref).
"""
metabolites(model::GeckoModel) = [metabolites(model.inner); genes(model).*"#supply"]
metabolites(model::GeckoModel) = [metabolites(model.inner); genes(model) .* "#supply"]
"""
n_metabolites(model::GeckoModel)
Return the number of metabolites, both real and pseudo, for a [`GeckoModel`](@ref).
"""
n_metabolites(model::GeckoModel) = length(metabolites(model))
\ No newline at end of file
n_metabolites(model::GeckoModel) = length(metabolites(model))
......@@ -80,8 +80,8 @@ function _gecko_mass_group_coupling(model::GeckoModel)
[j for (_, j, _) in tmp],
[mm for (_, _, mm) in tmp],
length(model.coupling_row_mass_group),
n_genes(model),
)
n_genes(model),
)
end
"""
......@@ -92,4 +92,7 @@ reaction-keyed dictionary, if solved.
"""
flux_dict(model::GeckoModel, opt_model) =
is_solved(opt_model) ?
Dict(fluxes(model) .=> reaction_flux(model)' * value.(opt_model[:x])[1:n_reactions(model)] ) : nothing
\ No newline at end of file
Dict(
fluxes(model) .=>
reaction_flux(model)' * value.(opt_model[:x])[1:n_reactions(model)],
) : nothing
Supports Markdown
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