Skip to content

Commit 1ba966b

Browse files
committed
fix: set solver using cobra configuration
Signed-off-by: Josh Loecker <joshloecker@icloud.com>
1 parent c55dcf2 commit 1ba966b

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

main/como/create_context_specific_model.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ def _build_model( # noqa: C901
442442

443443
# set solver
444444
reference_model.solver = solver.lower()
445+
cobra.Configuration().solver = solver.lower()
445446

446447
# check number of unsolvable reactions for reference model under media assumptions
447448
# incon_rxns, cobra_model = _feasibility_test(cobra_model, "before_seeding")
@@ -626,10 +627,10 @@ def create_context_specific_model( # noqa: C901
626627
raise ValueError(f"Output file type {output_type} not recognized. Must be one of: 'xml', 'mat', 'json'")
627628

628629
if algorithm not in Algorithm:
629-
raise ValueError(f"Algorithm {algorithm} not supported. Please use one of: GIMME, FASTCORE, or IMAT")
630+
raise ValueError(f"Algorithm {algorithm} not supported. Use one of {', '.join(a.value for a in Algorithm)}")
630631

631632
if solver not in Solver:
632-
raise ValueError(f"Solver '{solver}' not supported. Use 'GLPK' or 'GUROBI'")
633+
raise ValueError(f"Solver '{solver}' not supported. Use one of {', '.join(s.value for s in Solver)}")
633634

634635
if boundary_rxns_filepath:
635636
boundary_reactions = _collect_boundary_reactions(boundary_rxns_filepath)
@@ -662,7 +663,7 @@ def create_context_specific_model( # noqa: C901
662663
bound_ub=boundary_reactions.upper_bounds,
663664
exclude_rxns=exclude_rxns,
664665
force_rxns=force_rxns,
665-
solver=solver.value,
666+
solver=solver.value.lower(),
666667
low_thresh=low_threshold,
667668
high_thresh=high_threshold,
668669
)

0 commit comments

Comments
 (0)