Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
COBREXA.jl
Manage
Activity
Members
Plan
External wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LCSB-BioCore
COBREXA.jl
Commits
d5e0ff6a
Unverified
Commit
d5e0ff6a
authored
3 years ago
by
St. Elmo
Browse files
Options
Downloads
Patches
Plain Diff
added fva like warmup point function
parent
d8f95671
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/analysis/sampling/hit_and_run.jl
+14
-6
14 additions, 6 deletions
src/analysis/sampling/hit_and_run.jl
src/analysis/sampling/warmup.jl
+38
-0
38 additions, 0 deletions
src/analysis/sampling/warmup.jl
with
52 additions
and
6 deletions
src/analysis/sampling/hit_and_run.jl
+
14
−
6
View file @
d5e0ff6a
...
...
@@ -47,17 +47,25 @@ samples = hit_and_run(100_000, opt_model; keepevery=10, samplesize=5000)
```
"""
function
hit_and_run
(
N
::
Int
,
opt_model
;
model
,
optimizer
;
modifications
=
[],
N
=
1000
,
keepevery
=
_constants
.
sampling_keep_iters
,
samplesize
=
_constants
.
sampling_size
,
random_objective
=
false
,
num_warmup_points
=
length
(
reactions
(
model
))
)
lbs
,
ubs
=
get_bound_vectors
(
opt_model
)
# get actual ub and lb constraints, can't use model function because the user may have changed them in the function arguments
wpoints
=
_get_warmup_points
(
opt_model
;
random_objective
=
random_objective
)
# generate warmup points
ws
=
flux_variability_analysis
(
model
,
collect
(
1
:
10
),
Tulip
.
Optimizer
;
bounds
=
objective_bounds
(
0.90
),
ret
=
m
->
COBREXA
.
JuMP
.
value
.
(
m
[
:
x
])
)
nwpts
=
size
(
wpoints
,
2
)
# number of warmup points generated
samples
=
zeros
(
size
(
wpoints
,
1
),
samplesize
)
# sample storage
current_point
=
zeros
(
size
(
wpoints
,
1
))
...
...
This diff is collapsed.
Click to expand it.
src/analysis/sampling/warmup.jl
0 → 100644
+
38
−
0
View file @
d5e0ff6a
"""
warmup(
model::MetabolicModel,
optimizer;
warmup_points::Vector{Int},
modifications = [],
workers = [myid()],
Generates warmup points for samplers by sequentially minimizing and maximizing
reactions at `warmup_points`. Very similar to [`flux_variability_analysis`](@ref).
"""
function
warmup
(
model
::
MetabolicModel
,
optimizer
;
warmup_points
::
Vector
{
Int
},
modifications
=
[],
workers
=
[
myid
()],
)
# create optimization problem, apply constraints, load on all workers
optmodel
=
make_optimization_model
(
model
,
optimizer
)
for
mod
in
modifications
mod
(
model
,
optmodel
)
end
map
(
fetch
,
save_at
.
(
workers
,
:
warmup_model
,
Ref
(
:
(
$
optmodel
))))
ret
=
m
->
value
.
(
m
[
:
x
])
# get all the fluxes
fluxes
=
dpmap
(
rid
->
:
(
$
COBREXA
.
_FVA_optimize_reaction
(
warmup_model
,
$
rid
,
$
ret
)),
CachingPool
(
workers
),
[
-
warmup_points
warmup_points
],
)
# free the data on workers
map
(
fetch
,
remove_from
.
(
workers
,
:
warmup_model
))
return
fluxes
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment