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
7251cdca
Unverified
Commit
7251cdca
authored
Jun 17, 2021
by
Laurent Heirendt
✈
Committed by
GitHub
Jun 17, 2021
Browse files
Merge pull request #341 from LCSB-BioCore/tp-better-errors
better errors for optimizer mods
parents
6812fbdd
73e1d547
Pipeline
#43243
failed with stages
in 12 minutes and 58 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/analysis/modifications/optimizer.jl
View file @
7251cdca
...
...
@@ -59,6 +59,7 @@ Change the lower and upper bounds (`lb` and `ub` respectively) of reaction `id`.
function
change_constraint
(
id
::
String
,
lb
,
ub
)
(
model
,
opt_model
)
->
begin
ind
=
first
(
indexin
([
id
],
reactions
(
model
)))
isnothing
(
ind
)
&&
throw
(
DomainError
(
id
,
"No matching reaction was found."
))
set_optmodel_bound!
(
ind
,
opt_model
,
lb
=
lb
,
ub
=
ub
)
end
end
...
...
@@ -88,6 +89,8 @@ function change_objective(
[
first
(
indexin
([
rxnid
],
reactions
(
model
)))
for
rxnid
in
new_objective
]
end
any
(
isnothing
.
(
objective_indices
))
&&
throw
(
DomainError
(
new_objective
,
"No matching reaction found for one or more ids."
))
# Initialize weights
opt_weights
=
spzeros
(
n_reactions
(
model
))
...
...
test/analysis/flux_balance_analysis.jl
View file @
7251cdca
...
...
@@ -67,6 +67,30 @@ end
31.999999998962604
,
atol
=
TEST_TOLERANCE
,
)
@test_throws
DomainError
flux_balance_analysis_dict
(
model
,
Tulip
.
Optimizer
;
modifications
=
[
change_constraint
(
"gbbrsh"
,
-
12
,
-
12
)
],
)
@test_throws
DomainError
flux_balance_analysis_dict
(
model
,
Tulip
.
Optimizer
;
modifications
=
[
change_objective
(
"gbbrsh"
)
],
)
@test_throws
DomainError
flux_balance_analysis_dict
(
model
,
Tulip
.
Optimizer
;
modifications
=
[
change_objective
(
[
"BIOMASS_Ecoli_core_w_GAM"
;
"gbbrsh"
]
)
],
)
end
@testset
"Flux balance analysis with CoreModelCoupled"
begin
...
...
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