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
bb1a48a4
Commit
bb1a48a4
authored
Feb 11, 2021
by
Miroslav Kratochvil
Committed by
Miroslav Kratochvil
Feb 19, 2021
Browse files
[WIP] DistributedData FVA
parent
52246334
Changes
3
Hide whitespace changes
Inline
Side-by-side
Project.toml
View file @
bb1a48a4
...
...
@@ -7,6 +7,7 @@ version = "0.1.0"
Clp
=
"e2554f3b-3117-50c0-817c-e040a3ddf72d"
DelimitedFiles
=
"8bb1440f-4735-579b-a4ab-409b98df4dab"
Distributed
=
"8ba89e20-285c-5b6f-9357-94700520ee1b"
DistributedData
=
"f6a0035f-c5ac-4ad0-b410-ad102ced35df"
Documenter
=
"e30172f5-a6a5-5a46-863b-614d45cd2de4"
GLPK
=
"60bf3e95-4087-53dc-ae20-288a0d20c6a6"
HDF5
=
"f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
...
...
src/COBREXA.jl
View file @
bb1a48a4
...
...
@@ -8,6 +8,7 @@ using JuMP
using
MAT
using
Distributed
using
SBML
using
DistributedData
import
Pkg
# import src files
...
...
@@ -45,8 +46,8 @@ export speye, LinearModel, nReactions, nMetabolites, nCouplingConstraints,
removeCouplingConstraints!
,
removeCouplingConstraints
,
changeCouplingBounds!
,
changeCouplingBounds
,
verifyConsistency
,
findExchangeReactions
,
findExchangeMetabolites
,
solveLP
,
loadModel
,
loadSBML
M
odel
,
writeModel
,
fluxBalanceAnalysis
,
fluxVariabilityAnalysis
,
parFVA
,
solveLP
,
loadModel
,
loadSBML
m
odel
,
writeModel
,
fluxBalanceAnalysis
,
fluxVariabilityAnalysis
,
parFVA
,
parFVA2
,
convertToExportable
,
createParPool
end
src/analysis/fva.jl
View file @
bb1a48a4
...
...
@@ -87,3 +87,34 @@ function allocateReacs(reactions::Array{Int64, 1}, nWorkers::Int)
return
allocatedReacs
end
function
parFVA2
(
model
::
LinearModel
,
reactions
::
Vector
{
Int
},
optimizer
,
workers
)
if
any
(
reactions
.>
length
(
model
.
rxns
))
throw
(
ArgumentError
(
"reactions contain an out-of-bounds index"
))
end
γ
=
1.
fluxes
=
zeros
(
length
(
reactions
),
2
)
(
optimization_model
,
x₀
)
=
fluxBalanceAnalysis
(
model
::
LinearModel
,
optimizer
)
Z₀
=
JuMP
.
objective_value
(
optimization_model
)
x
=
JuMP
.
all_variables
(
optimization_model
)
@constraint
(
optimization_model
,
model
.
c
'
*
x
≥
γ
*
Z₀
)
fetch
.
([
save_at
(
w
,
:
cobrexa_parfva_model
,
optimization_model
)
for
w
in
workers
])
fluxes
=
vcat
(
dpmap
(
reactions
,
rid
->
:
(
begin
var
=
JuMP
.
all_variables
(
cobrexa_parfva_model
)[
$
rid
]
@objective
(
cobrexa_parfva_model
,
MOI
.
MIN_SENSE
,
var
)
JuMP
.
optimize!
(
cobrexa_parfva_model
)
min_flux
=
JuMP
.
objective_value
(
cobrexa_parfva_model
)
@objective
(
cobrexa_parfva_model
,
MOI
.
MIN_SENSE
,
var
)
JuMP
.
optimize!
(
cobrexa_parfva_model
)
max_flux
=
JuMP
.
objective_value
(
cobrexa_parfva_model
)
[
min_flux
max_flux
]
end
),
workers
)
...
)
fetch
.
([
remove_from
(
w
,
:
cobrexa_parfva_model
)
for
w
in
workers
])
return
fluxes
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