diff COBRAxy/ras_to_bounds.py @ 64:b10da5046afd draft

Uploaded
author luca_milaz
date Sun, 13 Oct 2024 08:25:29 +0000
parents 5302258f8262
children 1f928ad6a87e
line wrap: on
line diff
--- a/COBRAxy/ras_to_bounds.py	Sun Oct 13 08:11:43 2024 +0000
+++ b/COBRAxy/ras_to_bounds.py	Sun Oct 13 08:25:29 2024 +0000
@@ -123,7 +123,7 @@
             scaling_factor = ras_row[reaction]
             lower_bound=model.reactions.get_by_id(reaction).lower_bound
             upper_bound=model.reactions.get_by_id(reaction).upper_bound
-            warning("Reaction: "+reaction+" Lower Bound: "+str(lower_bound)+" Upper Bound: "+str(upper_bound)+" Scaling Factor: "+str(scaling_factor))
+            #warning("Reaction: "+reaction+" Lower Bound: "+str(lower_bound)+" Upper Bound: "+str(upper_bound)+" Scaling Factor: "+str(scaling_factor))
             valMax=float((upper_bound)*scaling_factor)
             valMin=float((lower_bound)*scaling_factor)
             if upper_bound!=0 and lower_bound==0:
@@ -185,9 +185,9 @@
         rxn.upper_bound = float(df_FVA.loc[reaction, "maximum"])
 
     if ras is not None:
-        #Parallel(n_jobs=cpu_count())(delayed(process_ras_cell)(cellName, ras_row, model, rxns_ids, output_folder) for cellName, ras_row in ras.iterrows())
-         for cellName, ras_row in ras.iterrows():
-            process_ras_cell(cellName, ras_row, model, rxns_ids, output_folder) 
+        Parallel(n_jobs=cpu_count())(delayed(process_ras_cell)(cellName, ras_row, model, rxns_ids, output_folder) for cellName, ras_row in ras.iterrows())
+         #for cellName, ras_row in ras.iterrows():
+            #process_ras_cell(cellName, ras_row, model, rxns_ids, output_folder) 
     else:
         model_new = model.copy()
         apply_ras_bounds(model_new, pd.Series([1]*len(rxns_ids), index=rxns_ids), rxns_ids)
@@ -233,7 +233,7 @@
         
         
         # Concatenate all ras DataFrames into a single DataFrame
-        ras_combined = pd.concat(ras_list, axis=1)
+        ras_combined = pd.concat(ras_list, axis=0)
         # Normalize the RAS values by max RAS
         ras_combined = ras_combined.div(ras_combined.max(axis=0))
         ras_combined = ras_combined.fillna(0)