comparison COBRAxy/marea.py @ 276:2748cef7fa12 draft

Uploaded
author francesco_lapi
date Mon, 05 May 2025 10:33:30 +0000
parents 99703bcaa290
children 1bf66a30ab23
comparison
equal deleted inserted replaced
275:e87aeb3a33cd 276:2748cef7fa12
291 tmp = d.get(el_id[2:]) 291 tmp = d.get(el_id[2:])
292 if tmp != None: 292 if tmp != None:
293 p_val :float = tmp[0] 293 p_val :float = tmp[0]
294 f_c = tmp[1] 294 f_c = tmp[1]
295 z_score = tmp[2] 295 z_score = tmp[2]
296
297 if math.isnan(p_val) or (isinstance(f_c, float) and math.isnan(f_c)): continue
298
296 if p_val <= threshold_P_V: 299 if p_val <= threshold_P_V:
297 if not isinstance(f_c, str): 300 if not isinstance(f_c, str):
298 if abs(f_c) < ((threshold_F_C - 1) / (abs(threshold_F_C) + 1)): # 301 if abs(f_c) < ((threshold_F_C - 1) / (abs(threshold_F_C) + 1)): #
299 col = grey 302 col = grey
300 width = str(minT) 303 width = str(minT)
489 for reactionId, values in rpsEnrichmentRes.items(): 492 for reactionId, values in rpsEnrichmentRes.items():
490 pValue = values[0] 493 pValue = values[0]
491 foldChange = values[1] 494 foldChange = values[1]
492 z_score = values[2] 495 z_score = values[2]
493 496
497 if math.isnan(pValue) or (isinstance(foldChange, float) and math.isnan(foldChange)): continue
498
494 if isinstance(foldChange, str): foldChange = float(foldChange) 499 if isinstance(foldChange, str): foldChange = float(foldChange)
495 if pValue >= ARGS.pValue: # pValue above tresh: dashed arrow 500 if pValue >= ARGS.pValue: # pValue above tresh: dashed arrow
496 INSIGNIFICANT_ARROW.styleReactionElements(metabMap, reactionId) 501 INSIGNIFICANT_ARROW.styleReactionElements(metabMap, reactionId)
497 continue 502 continue
498 503
759 continue 764 continue
760 765
761 # fallthrough is intended, regular scores need to be computed when tips aren't net but RAS datasets aren't used 766 # fallthrough is intended, regular scores need to be computed when tips aren't net but RAS datasets aren't used
762 p_value, z_score = computePValue(l1, l2) 767 p_value, z_score = computePValue(l1, l2)
763 avg = fold_change(sum(l1) / len(l1), sum(l2) / len(l2)) 768 avg = fold_change(sum(l1) / len(l1), sum(l2) / len(l2))
764 if math.isnan(p_value) or (isinstance(avg, float) and math.isnan(avg)): continue
765 if not isinstance(z_score, str) and max_z_score < abs(z_score): max_z_score = abs(z_score) 769 if not isinstance(z_score, str) and max_z_score < abs(z_score): max_z_score = abs(z_score)
766 tmp[reactId] = [float(p_value), avg, z_score] 770 tmp[reactId] = [float(p_value), avg, z_score]
767 771
768 except (TypeError, ZeroDivisionError): continue 772 except (TypeError, ZeroDivisionError): continue
769 773