@@ -308,9 +308,16 @@ def _build_with_imat(
308308 expr_vector : npt .NDArray ,
309309 expr_thesh : tuple [float , float ],
310310 force_gene_ids : Sequence [int ],
311+ solver : str ,
311312) -> (cobra .Model , pd .DataFrame ):
312313 expr_vector = np .array (expr_vector )
313- properties = IMATProperties (exp_vector = expr_vector , exp_thresholds = expr_thesh , core = force_gene_ids , epsilon = 0.01 )
314+ properties = IMATProperties (
315+ exp_vector = expr_vector ,
316+ exp_thresholds = expr_thesh ,
317+ core = force_gene_ids ,
318+ epsilon = 0.01 ,
319+ solver = solver .upper (),
320+ )
314321 algorithm = IMAT (s_matrix , np .array (lb ), np .array (ub ), properties )
315322 context_rxns : npt .NDArray = algorithm .run ()
316323 fluxes : pd .Series = algorithm .sol .to_series ()
@@ -507,7 +514,14 @@ def _build_model( # noqa: C901
507514 elif recon_algorithm == Algorithm .IMAT :
508515 context_model_cobra : cobra .Model
509516 context_model_cobra , flux_df = _build_with_imat (
510- reference_model , s_matrix , lb , ub , expr_vector , exp_thresh , idx_force
517+ reference_model ,
518+ s_matrix ,
519+ lb ,
520+ ub ,
521+ expr_vector ,
522+ exp_thresh ,
523+ idx_force ,
524+ solver = solver ,
511525 )
512526 imat_reactions = flux_df .rxn
513527 model_reactions = [reaction .id for reaction in context_model_cobra .reactions ]
@@ -626,10 +640,10 @@ def create_context_specific_model( # noqa: C901
626640 raise ValueError (f"Output file type { output_type } not recognized. Must be one of: 'xml', 'mat', 'json'" )
627641
628642 if algorithm not in Algorithm :
629- raise ValueError (f"Algorithm { algorithm } not supported. Please use one of: GIMME, FASTCORE, or IMAT " )
643+ raise ValueError (f"Algorithm { algorithm } not supported. Use one of { ', ' . join ( a . value for a in Algorithm ) } " )
630644
631645 if solver not in Solver :
632- raise ValueError (f"Solver '{ solver } ' not supported. Use 'GLPK' or 'GUROBI' " )
646+ raise ValueError (f"Solver '{ solver } ' not supported. Use one of { ', ' . join ( s . value for s in Solver ) } " )
633647
634648 if boundary_rxns_filepath :
635649 boundary_reactions = _collect_boundary_reactions (boundary_rxns_filepath )
@@ -662,7 +676,7 @@ def create_context_specific_model( # noqa: C901
662676 bound_ub = boundary_reactions .upper_bounds ,
663677 exclude_rxns = exclude_rxns ,
664678 force_rxns = force_rxns ,
665- solver = solver .value ,
679+ solver = solver .value . lower () ,
666680 low_thresh = low_threshold ,
667681 high_thresh = high_threshold ,
668682 )
0 commit comments