Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LCSB-BioCore
COBREXA.jl
Commits
bae8f421
Unverified
Commit
bae8f421
authored
Apr 01, 2021
by
St. Elmo
Committed by
St. Elmo
Apr 02, 2021
Browse files
remove extra returns
parent
04493072
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/analysis/fba.jl
View file @
bae8f421
...
...
@@ -21,8 +21,7 @@ of the model, if the solution is found.
Arguments are passed to [`flux_balance_analysis`](@ref).
"""
function
flux_balance_analysis_vec
(
args
...
)
::
Union
{
Vector
{
Float64
},
Nothing
}
optmodel
=
flux_balance_analysis
(
args
...
)
vars
=
optmodel
[
:
x
]
(
optmodel
,
vars
)
=
flux_balance_analysis
(
args
...
)
termination_status
(
optmodel
)
in
[
MOI
.
OPTIMAL
,
MOI
.
LOCALLY_SOLVED
]
||
return
nothing
value
.
(
vars
)
...
...
@@ -74,7 +73,7 @@ function fba(
# get core optimization problem
cbm
=
make_optimization_model
(
model
,
optimizer
,
sense
=
sense
)
v
=
cbm
[
:
x
]
# fluxes
# modify core optimization problem according to user specifications
if
!
isempty
(
solver_attributes
)
# set other attributes
for
(
k
,
val
)
in
solver_attributes
...
...
src/analysis/fva.jl
View file @
bae8f421
...
...
@@ -38,7 +38,7 @@ function flux_variability_analysis(
end
optimization_model
=
flux_balance_analysis
(
model
,
optimizer
)
Z0
=
COBREXA
.
JuMP
.
objective_value
(
optimization_model
)
Z0
=
JuMP
.
objective_value
(
optimization_model
)
optimization_model
=
nothing
# we won't need this one anymore, so free the memory
# store a JuMP optimization model at all workers
...
...
@@ -92,7 +92,7 @@ Internal helper function for adding constraints to a model. Exists mainly
because for avoiding namespace problems on remote workers.
"""
function
_FVA_add_constraint
(
model
,
c
,
x
,
Z0
,
gamma
)
COBREXA
.
JuMP
.
@constraint
(
model
,
c
'
*
x
≥
gamma
*
Z0
)
JuMP
.
@constraint
(
model
,
c
'
*
x
≥
gamma
*
Z0
)
end
"""
...
...
@@ -103,11 +103,11 @@ namespace problems.
"""
function
_FVA_optimize_reaction
(
model
,
rid
)
sense
=
rid
>
0
?
MOI
.
MAX_SENSE
:
MOI
.
MIN_SENSE
var
=
COBREXA
.
JuMP
.
all_variables
(
model
)[
abs
(
rid
)]
var
=
JuMP
.
all_variables
(
model
)[
abs
(
rid
)]
COBREXA
.
JuMP
.
@objective
(
model
,
sense
,
var
)
COBREXA
.
JuMP
.
optimize!
(
model
)
return
COBREXA
.
JuMP
.
objective_value
(
model
)
JuMP
.
@objective
(
model
,
sense
,
var
)
JuMP
.
optimize!
(
model
)
return
JuMP
.
objective_value
(
model
)
end
"""
...
...
src/base/solver.jl
View file @
bae8f421
...
...
@@ -10,7 +10,7 @@ function make_optimization_model(
m
,
n
=
size
(
stoichiometry
(
model
))
xl
,
xu
=
bounds
(
model
)
optimization_model
=
COBREXA
.
JuMP
.
Model
(
optimizer
)
optimization_model
=
JuMP
.
Model
(
optimizer
)
@variable
(
optimization_model
,
x
[
i
=
1
:
n
])
@objective
(
optimization_model
,
sense
,
objective
(
model
)
'
*
x
)
@constraint
(
optimization_model
,
mb
,
stoichiometry
(
model
)
*
x
.==
balance
(
model
))
# mass balance
...
...
@@ -29,6 +29,7 @@ function optimize_model(
sense
=
MOI
.
MIN_SENSE
,
)
where
{
LM
<:
MetabolicModel
}
optimization_model
=
make_optimization_model
(
model
,
optimizer
;
sense
=
sense
)
COBREXA
.
JuMP
.
optimize!
(
optimization_model
)
x
=
optimization_model
[
:
x
]
JuMP
.
optimize!
(
optimization_model
)
return
optimization_model
end
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