Commit 73e1d547 authored by Taneli Pusa's avatar Taneli Pusa
Browse files

better errors for optimizer mods

typo
parent 00721ee9
Pipeline #43199 passed with stages
in 9 minutes and 5 seconds
......@@ -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))
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment