Commit 7244ee67 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil
Browse files

simplify gecko a bit (remove unnecessary reaction arms)

parent 86959197
Pipeline #55083 failed with stages
in 9 minutes and 35 seconds
......@@ -26,65 +26,45 @@ function make_gecko_model(
continue
end
push!(coupling_row_reaction, i)
reaction_coupling_row = length(coupling_row_reaction)
reaction_coupling_row =
length(isozymes) > 1 ? begin
push!(coupling_row_reaction, i)
length(coupling_row_reaction)
end : 0
for (iidx, isozyme) in enumerate(isozymes)
if min(lbs[i], ubs[i]) < 0 && isozyme.kcat_reverse > _constants.tolerance
push!(
columns,
_gecko_column(
i,
iidx,
-1,
reaction_coupling_row,
max(-ubs[i], 0),
-lbs[i],
_gecko_make_gene_product_coupling(
isozyme.gene_product_count,
isozyme.kcat_reverse,
gene_name_lookup,
gene_row_lookup,
coupling_row_gene_product,
for (lb, ub, kcat, dir) in [
(-ubs[i], -lbs[i], isozyme.kcat_reverse, -1),
(lbs[i], ubs[i], isozyme.kcat_forward, 1),
]
if max(lb, ub) > 0 && kcat > _constants.tolerance
push!(
columns,
_gecko_column(
i,
iidx,
dir,
reaction_coupling_row,
max(lb, 0),
ub,
_gecko_make_gene_product_coupling(
isozyme.gene_product_count,
kcat,
gene_name_lookup,
gene_row_lookup,
coupling_row_gene_product,
),
_gecko_make_mass_group_coupling(
isozyme.gene_product_count,
kcat,
gene_mass_group,
gene_product_mass,
mass_group_lookup,
coupling_row_mass_group,
),
),
_gecko_make_mass_group_coupling(
isozyme.gene_product_count,
isozyme.kcat_reverse,
gene_mass_group,
gene_product_mass,
mass_group_lookup,
coupling_row_mass_group,
),
),
)
end
if max(lbs[i], ubs[i]) > 0 && isozyme.kcat_forward > _constants.tolerance
push!(
columns,
_gecko_column(
i,
iidx,
1,
reaction_coupling_row,
max(lbs[i], 0),
ubs[i],
_gecko_make_gene_product_coupling(
isozyme.gene_product_count,
isozyme.kcat_forward,
gene_name_lookup,
gene_row_lookup,
coupling_row_gene_product,
),
_gecko_make_mass_group_coupling(
isozyme.gene_product_count,
isozyme.kcat_forward,
gene_mass_group,
gene_product_mass,
mass_group_lookup,
coupling_row_mass_group,
),
),
)
)
end
end
end
end
......
......@@ -20,7 +20,6 @@ A pipe-able variant of [`protein_dict`](@ref).
"""
protein_dict(model::GeckoModel) = x -> protein_dict(model, x)
"""
protein_mass_group_dict(model::GeckoModel, opt_model)
......
......@@ -32,7 +32,7 @@ Compute the part of the coupling for [`GeckoModel`](@ref) that limits the
_gecko_reaction_coupling(model::GeckoModel) =
let tmp = [
(col.reaction_coupling_row, i, col.direction) for
(i, col) = enumerate(model.columns) if col.direction != 0
(i, col) = enumerate(model.columns) if col.reaction_coupling_row != 0
]
sparse(
[row for (row, _, _) in tmp],
......@@ -52,8 +52,8 @@ kind of protein available.
_gecko_gene_product_coupling(model::GeckoModel) =
let
tmp = [
(row, i, val) for (i, col) = enumerate(model.columns) if col.direction != 0
for (row, val) in col.gene_product_coupling
(row, i, val) for (i, col) in enumerate(model.columns) for
(row, val) in col.gene_product_coupling
]
sparse(
[row for (row, _, _) in tmp],
......@@ -73,8 +73,8 @@ mass of each group of gene products.
_gecko_mass_group_coupling(model::GeckoModel) =
let
tmp = [
(row, i, val) for (i, col) = enumerate(model.columns) if col.direction != 0
for (row, val) in col.mass_group_coupling
(row, i, val) for (i, col) in enumerate(model.columns) for
(row, val) in col.mass_group_coupling
]
sparse(
[row for (row, _, _) in tmp],
......
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