diff COBRAxy/ras_to_bounds.py @ 122:7e1ce04cf192 draft

Uploaded
author luca_milaz
date Mon, 14 Oct 2024 08:22:30 +0000
parents 567ffd4333d4
children 258ff4208e52
line wrap: on
line diff
--- a/COBRAxy/ras_to_bounds.py	Mon Oct 14 08:19:38 2024 +0000
+++ b/COBRAxy/ras_to_bounds.py	Mon Oct 14 08:22:30 2024 +0000
@@ -123,9 +123,9 @@
     Returns:
         None
     """
-    for reaction in rxns_ids:
-        if reaction in ras_row.index and reaction not in mediumRxns_ids:
-            scaling_factor = ras_row[reaction]
+    for reaction in ras_row.index:
+        scaling_factor = ras_row[reaction]
+        if(scaling_factor not in [np.nan, None]):
             lower_bound=model.reactions.get_by_id(reaction).lower_bound
             upper_bound=model.reactions.get_by_id(reaction).upper_bound
             valMax=float((upper_bound)*scaling_factor)
@@ -178,6 +178,7 @@
     # Set medium conditions
     for reaction, value in medium.items():
         if value is not None:
+            ## SOLO ENGRO2
             if(reaction != "EX_thbpt_e" and reaction != "EX_lac__L_e"):
                 model.reactions.get_by_id(reaction).lower_bound = -float(value)
             if(reaction == "EX_lac__L_e"):
@@ -247,7 +248,8 @@
         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)
+        #ras_combined = ras_combined.fillna(0)
+        #il ras c'è per tutti o non c'è per nessuno