changeset 276:2748cef7fa12 draft default tip

Uploaded
author francesco_lapi
date Mon, 05 May 2025 10:33:30 +0000
parents e87aeb3a33cd
children
files COBRAxy/marea.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/COBRAxy/marea.py	Mon May 05 10:33:06 2025 +0000
+++ b/COBRAxy/marea.py	Mon May 05 10:33:30 2025 +0000
@@ -293,6 +293,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)): # 
@@ -491,6 +494,8 @@
         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)
@@ -761,7 +766,6 @@
             # fallthrough is intended, regular scores need to be computed when tips aren't net but RAS datasets aren't used
             p_value, z_score = computePValue(l1, l2)
             avg = fold_change(sum(l1) / len(l1), sum(l2) / len(l2))
-            if math.isnan(p_value) or (isinstance(avg, float) and math.isnan(avg)): 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), avg, z_score]