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
b027b2db
Unverified
Commit
b027b2db
authored
Apr 20, 2022
by
St. Elmo
Browse files
more comments
parent
efdd9fb1
Pipeline
#55315
passed with stages
in 14 minutes and 36 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/analysis/gecko.jl
View file @
b027b2db
...
...
@@ -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
))
]
...
...
src/base/types/wrappers/GeckoModel.jl
View file @
b027b2db
"""
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
)
[
...
...
src/base/utils/gecko.jl
View file @
b027b2db
...
...
@@ -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
],
...
...
test/data_static.jl
View file @
b027b2db
...
...
@@ -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
...
...
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