Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LCSB-BioCore
COBREXA.jl
Commits
9d47ecf9
Commit
9d47ecf9
authored
May 15, 2022
by
Miroslav Kratochvil
Browse files
eliminate the trailing spaces (and a case of mutability abuse)
parent
a294a6e4
Pipeline
#56522
passed with stages
in 12 minutes and 19 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/analysis/gecko.jl
View file @
9d47ecf9
...
...
@@ -147,24 +147,15 @@ function make_gecko_model(
push!
(
coupling_row_mass_group
,
_gecko_capacity
(
grp
,
idxs
,
mms
,
gmgb_
(
grp
)))
end
# create model with dummy objective
gm
=
GeckoModel
(
spzeros
(
length
(
columns
)
+
length
(
coupling_row_gene_product
)),
GeckoModel
(
[
_gecko_reaction_column_reactions
(
columns
,
model
)
'
*
objective
(
model
)
spzeros
(
length
(
coupling_row_gene_product
))
],
columns
,
coupling_row_reaction
,
collect
(
zip
(
coupling_row_gene_product
,
gpb_
.
(
gids
[
coupling_row_gene_product
]))),
coupling_row_mass_group
,
model
,
)
#=
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_reaction_column_reactions
(
gm
)
'
*
objective
(
gm
.
inner
)
spzeros
(
length
(
coupling_row_gene_product
))
]
return
gm
end
src/base/types/wrappers/GeckoModel.jl
View file @
9d47ecf9
...
...
@@ -16,7 +16,7 @@ end
"""
struct _gecko_capacity
A helper struct that contains the gene product capacity terms organized by
A helper struct that contains the gene product capacity terms organized by
the grouping type, e.g. metabolic or membrane groups etc.
"""
struct
_gecko_capacity
...
...
@@ -217,7 +217,7 @@ end
"""
balance(model::GeckoModel)
Return the balance of the reactions in 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
)
=
...
...
@@ -233,7 +233,7 @@ n_genes(model::GeckoModel) = length(model.coupling_row_gene_product)
"""
genes(model::GeckoModel)
Return the gene ids of genes that have enzymatic constraints associated with them.
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
]]
...
...
src/base/utils/gecko.jl
View file @
9d47ecf9
...
...
@@ -15,12 +15,20 @@ _gecko_reaction_name(original_name::String, direction::Int, isozyme_idx::Int) =
Retrieve a utility mapping between reactions and split reactions; rows
correspond to "
original
" reactions, columns correspond to "
split
" reactions.
"""
_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
],
n_reactions
(
model
.
inner
),
length
(
model
.
columns
),
_gecko_reaction_column_reactions
(
model
::
GeckoModel
)
=
_gecko_reaction_column_reactions
(
model
.
columns
,
model
.
inner
)
"""
_gecko_reaction_column_reactions(columns, inner)
Helper method that doesn't require the whole [`GeckoModel`](@ref).
"""
_gecko_reaction_column_reactions
(
columns
,
inner
)
=
sparse
(
[
col
.
reaction_idx
for
col
in
columns
],
1
:
length
(
columns
),
[
col
.
direction
>=
0
?
1
:
-
1
for
col
in
columns
],
n_reactions
(
inner
),
length
(
columns
),
)
"""
...
...
test/analysis/gecko.jl
View file @
9d47ecf9
...
...
@@ -54,7 +54,7 @@ end
@testset
"GECKO small model"
begin
#=
Implement the small model found in the supplment of the
Implement the small model found in the supplment of the
original GECKO paper. This model is nice to troubleshoot with,
because the stoich matrix is small.
=#
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment