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
7a029a29
Unverified
Commit
7a029a29
authored
Apr 06, 2021
by
St. Elmo
Browse files
format and remove Gurobi
parent
0128a96b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Project.toml
View file @
7a029a29
...
...
@@ -12,7 +12,6 @@ DistributedData = "f6a0035f-c5ac-4ad0-b410-ad102ced35df"
Documenter
=
"e30172f5-a6a5-5a46-863b-614d45cd2de4"
Downloads
=
"f43a241f-c20a-4ad4-852c-f6b1247861c6"
GLPK
=
"60bf3e95-4087-53dc-ae20-288a0d20c6a6"
Gurobi
=
"2e9cd046-0924-5485-92f1-d5272153d98b"
HDF5
=
"f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
JSON
=
"682c06a0-de6a-54ab-a142-c8b1cf79cde6"
JuMP
=
"4076af6c-e467-56ae-b986-b466b2749572"
...
...
src/analysis/flux_variability_analysis.jl
View file @
7a029a29
...
...
@@ -141,7 +141,7 @@ fva_max, fva_min = fva(model, biomass, optimizer; solver_attributes=atts)
function
flux_variability_analysis
(
model
::
StandardModel
,
optimizer
;
optimum_bound
=
1.0
-
DEFAULT_FVA_TOL
,
optimum_bound
=
1.0
-
DEFAULT_FVA_TOL
,
modifications
=
[(
model
,
opt_model
)
->
nothing
],
)
# Run FBA
...
...
@@ -157,14 +157,12 @@ function flux_variability_analysis(
v
=
opt_model
[
:
x
]
λ
=
COBREXA
.
JuMP
.
objective_value
(
opt_model
)
# objective value
λmin
=
min
(
optimum_bound
*
λ
,
λ
*
1.0
/
optimum_bound
)
λmax
=
max
(
optimum_bound
*
λ
,
λ
*
1.0
/
optimum_bound
)
λmin
=
min
(
optimum_bound
*
λ
,
λ
*
1.0
/
optimum_bound
)
λmax
=
max
(
optimum_bound
*
λ
,
λ
*
1.0
/
optimum_bound
)
COBREXA
.
JuMP
.
@constraint
(
opt_model
,
λmin
<=
COBREXA
.
JuMP
.
objective_function
(
opt_model
)
<=
λmax
# in case there is a negative bound
λmin
<=
COBREXA
.
JuMP
.
objective_function
(
opt_model
)
<=
λmax
# in case there is a negative bound
)
for
i
=
1
:
length
(
v
)
...
...
@@ -176,7 +174,7 @@ function flux_variability_analysis(
)
if
status
fva_max
[
model
.
reactions
[
i
]
.
id
]
=
Dict
(
zip
(
reactions
(
model
),
value
.
(
opt_model
[
:
x
])
))
Dict
(
zip
(
reactions
(
model
),
value
.
(
opt_model
[
:
x
])))
else
@warn
"Error maximizing index:
$
i with error
$
(termination_status(opt_model))"
fva_max
[
model
.
reactions
[
i
]
.
id
]
=
nothing
...
...
@@ -190,7 +188,7 @@ function flux_variability_analysis(
)
if
status
fva_min
[
model
.
reactions
[
i
]
.
id
]
=
Dict
(
zip
(
reactions
(
model
),
value
.
(
opt_model
[
:
x
])
))
Dict
(
zip
(
reactions
(
model
),
value
.
(
opt_model
[
:
x
])))
else
@warn
"Error minimizing index:
$
i with error
$
(termination_status(opt_model))"
fva_min
[
model
.
reactions
[
i
]
.
id
]
=
nothing
...
...
src/analysis/parsimonious_flux_balance_analysis.jl
View file @
7a029a29
...
...
@@ -49,8 +49,8 @@ function parsimonious_flux_balance_analysis(
@objective
(
opt_model
,
Min
,
sum
(
dot
(
v
,
v
)))
for
lbconval
in
[
1.0
,
0.999999
,
0.99999
,
0.9999
,
0.999
,
0.99
]
# sequentially relax bound for stability
λmin
=
min
(
lbconval
*
λ
,
λ
*
1.0
/
lbconval
)
λmax
=
max
(
lbconval
*
λ
,
λ
*
1.0
/
lbconval
)
λmin
=
min
(
lbconval
*
λ
,
λ
*
1.0
/
lbconval
)
λmax
=
max
(
lbconval
*
λ
,
λ
*
1.0
/
lbconval
)
@constraint
(
opt_model
,
pfbacon
,
...
...
test/analysis/flux_variability_analysis.jl
View file @
7a029a29
...
...
@@ -75,14 +75,14 @@ end
fva_max
,
fva_min
=
flux_variability_analysis
(
model
,
Tulip
.
Optimizer
;
optimum_bound
=
0.99
,
optimum_bound
=
0.99
,
modifications
=
[
change_solver_attribute
(
"IPM_IterationsLimit"
,
500
),
change_constraint
(
glucose
,
-
10
,
-
10
),
change_constraint
(
oxygen
,
0.0
,
0.0
),
],
)
@test
isapprox
(
fva_max
[
"EX_ac_e"
][
"EX_ac_e"
],
8.518549434876208
,
atol
=
1e-6
)
@test
isapprox
(
fva_min
[
"EX_ac_e"
][
"EX_ac_e"
],
7.448388738973361
,
atol
=
1e-6
)
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