Skip to content
Snippets Groups Projects
Commit 21a2d7c2 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil :bicyclist:
Browse files

format 341 + add a tiny simplification

parent 73e1d547
No related branches found
No related tags found
No related merge requests found
......@@ -83,13 +83,15 @@ function change_objective(
# Construct objective_indices array
if typeof(new_objective) == String
objective_indices = [first(indexin([new_objective], reactions(model)))]
objective_indices = indexin([new_objective], reactions(model))
else
objective_indices =
[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."))
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))
......
......@@ -283,8 +283,7 @@ function join_with_exchanges(
nnz_total =
sum(length(first(nnz)) for nnz in nnzs) +
length(models) * length(exchange_rxn_ids) +
length(exchange_met_ids) +
nnz_add
length(exchange_met_ids) + nnz_add
n_reactions_metabolic = sum(reaction_lengths)
n_reactions_total = n_reactions_metabolic + length(exchange_rxn_ids) + column_add
n_metabolites_metabolic = sum(metabolite_lengths)
......
......@@ -69,28 +69,20 @@ end
)
@test_throws DomainError flux_balance_analysis_dict(
model,
Tulip.Optimizer;
modifications = [
change_constraint("gbbrsh", -12, -12)
],
)
model,
Tulip.Optimizer;
modifications = [change_constraint("gbbrsh", -12, -12)],
)
@test_throws DomainError flux_balance_analysis_dict(
model,
Tulip.Optimizer;
modifications = [
change_objective("gbbrsh")
],
)
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"]
)
],
)
model,
Tulip.Optimizer;
modifications = [change_objective(["BIOMASS_Ecoli_core_w_GAM"; "gbbrsh"])],
)
end
@testset "Flux balance analysis with CoreModelCoupled" begin
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment