changeset 222:4c0bb0186d38 draft

Uploaded
author luca_milaz
date Sat, 14 Dec 2024 19:07:05 +0000
parents d0e2251fe8a6
children c2ce7d75fceb
files COBRAxy/ras_to_bounds.py
diffstat 1 files changed, 12 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/COBRAxy/ras_to_bounds.py	Sat Dec 14 19:02:16 2024 +0000
+++ b/COBRAxy/ras_to_bounds.py	Sat Dec 14 19:07:05 2024 +0000
@@ -129,19 +129,18 @@
     new_bounds = bounds.copy()
     for reaction in ras_row.index:
         scaling_factor = ras_row[reaction]
-        lower_bound=bounds.loc[reaction, "lower_bound"]
-        upper_bound=bounds.loc[reaction, "upper_bound"]
-        valMax=float((upper_bound)*scaling_factor)
-        valMin=float((lower_bound)*scaling_factor)
-        if np.isnan(scaling_factor):
-            warning(f"scaling_factor values for {reaction}is None")
-        if upper_bound!=0 and lower_bound==0:
-            new_bounds.loc[reaction, "upper_bound"] = valMax
-        if upper_bound==0 and lower_bound!=0:
-            new_bounds.loc[reaction, "lower_bound"] = valMin
-        if upper_bound!=0 and lower_bound!=0:
-            new_bounds.loc[reaction, "lower_bound"] = valMin
-            new_bounds.loc[reaction, "upper_bound"] = valMax
+        if not np.isnan(scaling_factor):
+            lower_bound=bounds.loc[reaction, "lower_bound"]
+            upper_bound=bounds.loc[reaction, "upper_bound"]
+            valMax=float((upper_bound)*scaling_factor)
+            valMin=float((lower_bound)*scaling_factor)
+            if upper_bound!=0 and lower_bound==0:
+                new_bounds.loc[reaction, "upper_bound"] = valMax
+            if upper_bound==0 and lower_bound!=0:
+                new_bounds.loc[reaction, "lower_bound"] = valMin
+            if upper_bound!=0 and lower_bound!=0:
+                new_bounds.loc[reaction, "lower_bound"] = valMin
+                new_bounds.loc[reaction, "upper_bound"] = valMax
     return new_bounds
 
 def process_ras_cell(cellName, ras_row, model, rxns_ids, output_folder):