Mercurial > repos > bimib > marea_2
changeset 222:a15f5ef34d18 draft
Uploaded
author | francesco_lapi |
---|---|
date | Thu, 01 Aug 2024 15:57:21 +0000 |
parents | 3cbc03acc7b5 |
children | 14c5209b364e |
files | marea_2/flux_to_map.py |
diffstat | 1 files changed, 7 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/marea_2/flux_to_map.py Thu Aug 01 15:55:30 2024 +0000 +++ b/marea_2/flux_to_map.py Thu Aug 01 15:57:21 2024 +0000 @@ -376,6 +376,7 @@ Encodes possible arrow colors based on their meaning in the enrichment process. """ Invalid = "#BEBEBE" # gray, fold-change under treshold + Transparent = "#ffffff00" # white, not significant p-value UpRegulated = "#ecac68" # red, up-regulated reaction DownRegulated = "#6495ed" # blue, down-regulated reaction @@ -429,7 +430,6 @@ # Now we style the arrow head(s): idOpt1, idOpt2 = getArrowHeadElementId(reactionId) self.applyTo(idOpt1, metabMap, self.toStyleStr(downSizedForTips = True)) - print(self.toStyleStr(downSizedForTips = True)) if idOpt2: self.applyTo(idOpt2, metabMap, self.toStyleStr(downSizedForTips = True)) @@ -486,30 +486,29 @@ pValue = values[0] foldChange = values[1] z_score = values[2] - print(reactionId) + if isinstance(foldChange, str): foldChange = float(foldChange) if pValue >= ARGS.pValue: # pValue above tresh: dashed arrow INSIGNIFICANT_ARROW.styleReactionElements(metabMap, reactionId) INSIGNIFICANT_ARROW.styleReactionElements(metabMap, reactionId, mindReactionDir = False) - print(f'1') + continue if abs(foldChange) < (ARGS.fChange - 1) / (abs(ARGS.fChange) + 1): INVALID_ARROW.styleReactionElements(metabMap, reactionId) INVALID_ARROW.styleReactionElements(metabMap, reactionId, mindReactionDir = False) - print(f'2') + continue width = Arrow.MAX_W if not math.isinf(foldChange): try: width = max(abs(z_score * Arrow.MAX_W) / maxNumericZScore, Arrow.MIN_W) - print(f'3') + except ZeroDivisionError: pass #if not reactionId.endswith("_RV"): # RV stands for reversible reactions # Arrow(width, ArrowColor.fromFoldChangeSign(foldChange)).styleReactionElements(metabMap, reactionId) - # print(f'4') # continue #reactionId = reactionId[:-3] # Remove "_RV" @@ -524,14 +523,11 @@ # vvv These 2 if statements can both be true and can both happen if ARGS.net: # style arrow head(s): arrow.styleReactionElements(metabMap, reactionId + ("_B" if inversionScore == 2 else "_F")) - arrow.applyTo(("F_" if inversionScore == 2 else "B_") + reactionId, metabMap, f";stroke:#ffffff00;stroke-width:{width};stroke-dasharray:'5,5'") - print("prova") - print(("F_" if inversionScore == 2 else "B_") + reactionId) - print(f'5') + arrow.applyTo(("F_" if inversionScore == 2 else "B_") + reactionId, metabMap, f";stroke:{ArrowColor.Transparent};stroke-width:0;stroke-dasharray:None") if not ARGS.using_RAS: # style arrow body arrow.styleReactionElements(metabMap, reactionId, mindReactionDir = False) - print(f'6') + ############################ split class ###################################### def split_class(classes :pd.DataFrame, resolve_rules :Dict[str, List[float]]) -> Dict[str, List[List[float]]]: