@@ -308,9 +308,16 @@ def _build_with_imat(
308
308
expr_vector : npt .NDArray ,
309
309
expr_thesh : tuple [float , float ],
310
310
force_gene_ids : Sequence [int ],
311
+ solver : str ,
311
312
) -> (cobra .Model , pd .DataFrame ):
312
313
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
+ )
314
321
algorithm = IMAT (s_matrix , np .array (lb ), np .array (ub ), properties )
315
322
context_rxns : npt .NDArray = algorithm .run ()
316
323
fluxes : pd .Series = algorithm .sol .to_series ()
@@ -507,7 +514,14 @@ def _build_model( # noqa: C901
507
514
elif recon_algorithm == Algorithm .IMAT :
508
515
context_model_cobra : cobra .Model
509
516
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 ,
511
525
)
512
526
imat_reactions = flux_df .rxn
513
527
model_reactions = [reaction .id for reaction in context_model_cobra .reactions ]
@@ -626,10 +640,10 @@ def create_context_specific_model( # noqa: C901
626
640
raise ValueError (f"Output file type { output_type } not recognized. Must be one of: 'xml', 'mat', 'json'" )
627
641
628
642
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 ) } " )
630
644
631
645
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 ) } " )
633
647
634
648
if boundary_rxns_filepath :
635
649
boundary_reactions = _collect_boundary_reactions (boundary_rxns_filepath )
@@ -662,7 +676,7 @@ def create_context_specific_model( # noqa: C901
662
676
bound_ub = boundary_reactions .upper_bounds ,
663
677
exclude_rxns = exclude_rxns ,
664
678
force_rxns = force_rxns ,
665
- solver = solver .value ,
679
+ solver = solver .value . lower () ,
666
680
low_thresh = low_threshold ,
667
681
high_thresh = high_threshold ,
668
682
)
0 commit comments