diff COBRAxy/src/flux_simulation.py @ 548:5aef7b860706 draft default tip

Uploaded
author francesco_lapi
date Tue, 28 Oct 2025 11:04:40 +0000
parents 73f2f7e2be17
children
line wrap: on
line diff
--- a/COBRAxy/src/flux_simulation.py	Tue Oct 28 10:44:07 2025 +0000
+++ b/COBRAxy/src/flux_simulation.py	Tue Oct 28 11:04:40 2025 +0000
@@ -378,11 +378,11 @@
             model_input.reactions.get_by_id(rxn_index).upper_bound = row.upper_bound
         except KeyError:
             warning(f"Warning: Reaction {rxn_index} not found in model. Skipping.")
-    
-    return perform_sampling_and_analysis(model_input, cell_name)
+
+    return perform_sampling_and_analysis(None, cell_name, model_input=model_input)
 
 
-def perform_sampling_and_analysis(model_path: str, cell_name: str) -> List[pd.DataFrame]:
+def perform_sampling_and_analysis(model_path: str, cell_name: str, model_input: cobra.Model=None) -> List[pd.DataFrame]:
     """
     Common function to perform sampling and analysis on a prepared model.
 
@@ -395,8 +395,9 @@
     """
 
     returnList = []
-
-    model_input = model_utils.build_cobra_model_from_csv(model_path)
+    
+    if model_input is None:
+        model_input = model_utils.build_cobra_model_from_csv(model_path)
 
     if ARGS.sampling_enabled == "true":