Skip to content

Commit 852cb10

Browse files
authored
Merge pull request #191 from HelikarLab/fix-cc-integration
fix: do not make Solver private
2 parents c8068d8 + 96c80d8 commit 852cb10

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

main/como/create_context_specific_model.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from como.utils import Algorithm, Compartments, split_gene_expression_data, stringlist_to_list
2727

2828

29-
class _Solver(Enum):
29+
class Solver(Enum):
3030
"""Solver used to seed context specific model."""
3131

3232
GLPK = "GLPK"
@@ -35,17 +35,17 @@ class _Solver(Enum):
3535
GLPK_EXACT = "GLPK_EXACT"
3636

3737
@staticmethod
38-
def from_string(value: str) -> _Solver:
38+
def from_string(value: str) -> Solver:
3939
"""Convert string to Solver enum."""
4040
match value.lower():
4141
case "glpk":
42-
return _Solver.GLPK
42+
return Solver.GLPK
4343
case "gurobi":
44-
return _Solver.GUROBI
44+
return Solver.GUROBI
4545
case "scipy":
46-
return _Solver.SCIPY
46+
return Solver.SCIPY
4747
case "glpk_exact":
48-
return _Solver.GLPK_EXACT
48+
return Solver.GLPK_EXACT
4949
case _:
5050
raise ValueError(f"Unknown solver: {value}")
5151

@@ -78,7 +78,7 @@ class _Arguments:
7878
exclude_reactions_filepath: Path
7979
force_reactions_filepath: Path
8080
recon_algorithm: Algorithm
81-
solver: _Solver
81+
solver: Solver
8282
low_threshold: int
8383
high_threshold: int
8484
output_filetypes: list[str]
@@ -615,7 +615,7 @@ def create_context_specific_model( # noqa: C901
615615
algorithm: Algorithm = Algorithm.GIMME,
616616
low_threshold: float = -5,
617617
high_threshold: float = -3,
618-
solver: _Solver = _Solver.GLPK,
618+
solver: Solver = Solver.GLPK,
619619
output_filetypes: list[str] | None = None,
620620
):
621621
"""Create a context-specific model using the provided data."""
@@ -633,7 +633,7 @@ def create_context_specific_model( # noqa: C901
633633
if algorithm not in Algorithm:
634634
raise ValueError(f"Algorithm {algorithm} not supported. Please use one of: GIMME, FASTCORE, or IMAT")
635635

636-
if solver not in _Solver:
636+
if solver not in Solver:
637637
raise ValueError(f"Solver '{solver}' not supported. Use 'GLPK' or 'GUROBI'")
638638

639639
if boundary_rxns_filepath:
@@ -825,7 +825,7 @@ def _parse_args():
825825
)
826826
args = parser.parse_args()
827827
args.output_filetypes = stringlist_to_list(args.output_filetypes)
828-
args.solver = _Solver.from_string(args.solver) # type: ignore
828+
args.solver = Solver.from_string(args.solver) # type: ignore
829829
args.recon_algorithm = Algorithm.from_string(args.recon_algorithm) # type: ignore
830830
return _Arguments(**vars(args))
831831

0 commit comments

Comments
 (0)