Mercurial > repos > bimib > cobraxy
comparison COBRAxy/flux_to_map.py @ 275:e87aeb3a33cd draft
Uploaded
| author | francesco_lapi |
|---|---|
| date | Mon, 05 May 2025 10:33:06 +0000 |
| parents | d54d6728b204 |
| children | 7b8d9de81a86 |
comparison
equal
deleted
inserted
replaced
| 274:d54d6728b204 | 275:e87aeb3a33cd |
|---|---|
| 260 tmp = d.get(el_id[2:]) | 260 tmp = d.get(el_id[2:]) |
| 261 if tmp != None: | 261 if tmp != None: |
| 262 p_val :float = tmp[0] | 262 p_val :float = tmp[0] |
| 263 f_c = tmp[1] | 263 f_c = tmp[1] |
| 264 z_score = tmp[2] | 264 z_score = tmp[2] |
| 265 | |
| 266 if math.isnan(p_val) or (isinstance(f_c, float) and math.isnan(f_c)): continue | |
| 267 | |
| 265 if p_val < threshold_P_V: | 268 if p_val < threshold_P_V: |
| 266 if not isinstance(f_c, str): | 269 if not isinstance(f_c, str): |
| 267 if abs(f_c) < ((threshold_F_C - 1) / (abs(threshold_F_C) + 1)): # | 270 if abs(f_c) < ((threshold_F_C - 1) / (abs(threshold_F_C) + 1)): # |
| 268 col = grey | 271 col = grey |
| 269 width = str(minT) | 272 width = str(minT) |
| 474 for reactionId, values in fluxesEnrichmentRes.items(): | 477 for reactionId, values in fluxesEnrichmentRes.items(): |
| 475 pValue = values[0] | 478 pValue = values[0] |
| 476 foldChange = values[1] | 479 foldChange = values[1] |
| 477 z_score = values[2] | 480 z_score = values[2] |
| 478 | 481 |
| 482 if math.isnan(pValue) or (isinstance(foldChange, float) and math.isnan(foldChange)): | |
| 483 continue | |
| 484 | |
| 479 if isinstance(foldChange, str): foldChange = float(foldChange) | 485 if isinstance(foldChange, str): foldChange = float(foldChange) |
| 480 if pValue >= ARGS.pValue: # pValue above tresh: dashed arrow | 486 if pValue >= ARGS.pValue: # pValue above tresh: dashed arrow |
| 481 INSIGNIFICANT_ARROW.styleReactionElements(metabMap, reactionId) | 487 INSIGNIFICANT_ARROW.styleReactionElements(metabMap, reactionId) |
| 482 INSIGNIFICANT_ARROW.styleReactionElements(metabMap, reactionId, mindReactionDir = False) | 488 INSIGNIFICANT_ARROW.styleReactionElements(metabMap, reactionId, mindReactionDir = False) |
| 483 | 489 |
| 724 try: | 730 try: |
| 725 p_value, z_score = computePValue(l1, l2) | 731 p_value, z_score = computePValue(l1, l2) |
| 726 avg1 = sum(l1) / len(l1) | 732 avg1 = sum(l1) / len(l1) |
| 727 avg2 = sum(l2) / len(l2) | 733 avg2 = sum(l2) / len(l2) |
| 728 f_c = fold_change(avg1, avg2) | 734 f_c = fold_change(avg1, avg2) |
| 729 if math.isnan(p_value) or (isinstance(f_c, float) and math.isnan(f_c)): continue | |
| 730 if not isinstance(z_score, str) and max_z_score < abs(z_score): max_z_score = abs(z_score) | 735 if not isinstance(z_score, str) and max_z_score < abs(z_score): max_z_score = abs(z_score) |
| 731 | 736 |
| 732 tmp[reactId] = [float(p_value), f_c, z_score, avg1, avg2] | 737 tmp[reactId] = [float(p_value), f_c, z_score, avg1, avg2] |
| 733 except (TypeError, ZeroDivisionError): continue | 738 except (TypeError, ZeroDivisionError): continue |
| 734 | 739 |
