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
1685f21b
Unverified
Commit
1685f21b
authored
3 years ago
by
Miroslav Kratochvil
Browse files
Options
Downloads
Patches
Plain Diff
WIP
parent
35c07086
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/analysis/sampling/warmup.jl
+32
-28
32 additions, 28 deletions
src/analysis/sampling/warmup.jl
with
32 additions
and
28 deletions
src/analysis/sampling/warmup.jl
+
32
−
28
View file @
1685f21b
"""
warmup(
model::MetabolicModel,
optimizer;
warmup_points::Vector{Int},
modifications = [],
workers = [myid()],
warmup_from_variability(
n_points::Int,
model::MetabolicModel,
optimizer;
modifications = [],
workers = [myid()],
)
Generates warmup points for samplers by sequentially minimizing and maximizing
reactions at `warmup_points`. Very similar to [`flux_variability_analysis`](@ref).
Generates warmup points for samplers by minimizing and maximizing random
reactions. Very similar to
[`flux_variability_analysis`](@ref).
"""
function
warmup
(
function
warmup_from_variability
(
n_points
::
Int
,
model
::
MetabolicModel
,
optimizer
;
warmup_points
::
Vector
{
Int
},
modifications
=
[],
workerids
=
[
myid
()],
kwargs
...
)
# create optimization problem, apply constraints
end
function
warmup_from_variability
(
min_reactions
::
Vector
{
Int
},
max_reactions
::
Vector
{
Int
},
model
::
MetabolicModel
,
optimizer
;
modifications
=
[],
workers
::
Vector
{
Int
}
=
[
myid
()]
)
::
Tuple
{
Matrix
{
Float64
},
AbstractVector
{
Float64
},
AbstractVector
{
Float64
}}
# create optimization problem at workers, apply modifications
save_model
=
:
(
begin
model
=
$
model
...
...
@@ -28,29 +41,20 @@ function warmup(
end
)
# load on all workers
map
(
fetch
,
save_at
.
(
workerids
,
:
cobrexa_sampling_warmup_optmodel
,
Ref
(
save_model
)))
map
(
fetch
,
save_at
.
(
workers
,
:
cobrexa_sampling_warmup_optmodel
,
Ref
(
save_model
)))
# generate warm up points, like FVA
ret
=
m
->
value
.
(
m
[
:
x
])
# get all the fluxes, not just max/min like FVA
fluxes
=
dpmap
(
rid
->
:
(
$
COBREXA
.
_FVA_optimize_reaction
(
cobrexa_sampling_warmup_optmodel
,
$
rid
,
$
ret
,
optmodel
->
value
.
(
optmodel
[
:
x
])
,
)),
CachingPool
(
workerids
),
[
-
warmup_points
warmup_points
],
)
# get constraints from one of the workers
lbs
,
ubs
=
get_val_from
(
workerids
[
1
],
:
(
$
COBREXA
.
get_bound_vectors
(
cobrexa_sampling_warmup_optmodel
)),
CachingPool
(
workers
),
vcat
(
-
min_reactions
,
max_reactions
),
)
# free the data on workers
map
(
fetch
,
remove_from
.
(
worker
id
s
,
:
cobrexa_sampling_warmup_optmodel
))
map
(
fetch
,
remove_from
.
(
workers
,
:
cobrexa_sampling_warmup_optmodel
))
return
fluxes
,
lbs
,
ubs
return
hcat
(
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