changeset 275:e87aeb3a33cd draft

Uploaded
author francesco_lapi
date Mon, 05 May 2025 10:33:06 +0000
parents d54d6728b204
children 2748cef7fa12
files COBRAxy/flux_to_map.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/COBRAxy/flux_to_map.py	Mon May 05 10:15:46 2025 +0000
+++ b/COBRAxy/flux_to_map.py	Mon May 05 10:33:06 2025 +0000
@@ -262,6 +262,9 @@
                 p_val :float = tmp[0]
                 f_c = tmp[1]
                 z_score = tmp[2]
+
+                if math.isnan(p_val) or (isinstance(f_c, float) and math.isnan(f_c)): continue
+                
                 if p_val < threshold_P_V:
                     if not isinstance(f_c, str):
                         if abs(f_c) < ((threshold_F_C - 1) / (abs(threshold_F_C) + 1)): # 
@@ -476,6 +479,9 @@
         foldChange = values[1]
         z_score = values[2]
 
+        if math.isnan(pValue) or (isinstance(foldChange, float) and math.isnan(foldChange)):
+            continue
+
         if isinstance(foldChange, str): foldChange = float(foldChange)
         if pValue >= ARGS.pValue: # pValue above tresh: dashed arrow
             INSIGNIFICANT_ARROW.styleReactionElements(metabMap, reactionId)
@@ -726,7 +732,6 @@
             avg1 = sum(l1) / len(l1)
             avg2 = sum(l2) / len(l2)
             f_c = fold_change(avg1, avg2)
-            if math.isnan(p_value) or (isinstance(f_c, float) and math.isnan(f_c)): continue
             if not isinstance(z_score, str) and max_z_score < abs(z_score): max_z_score = abs(z_score)
             
             tmp[reactId] = [float(p_value), f_c, z_score, avg1, avg2]