Mercurial > repos > bimib > cobraxy
comparison COBRAxy/flux_to_map.py @ 185:c933b2c6a39e draft
Uploaded
author | francesco_lapi |
---|---|
date | Wed, 20 Nov 2024 17:27:41 +0000 |
parents | fa981714e87d |
children | f0197057876c |
comparison
equal
deleted
inserted
replaced
184:b5b7960a208e | 185:c933b2c6a39e |
---|---|
125 type = str, | 125 type = str, |
126 default='result', | 126 default='result', |
127 help = 'output path for maps') | 127 help = 'output path for maps') |
128 | 128 |
129 args :argparse.Namespace = parser.parse_args(args) | 129 args :argparse.Namespace = parser.parse_args(args) |
130 args.net = True | 130 args.net = True # TODO SICCOME I FLUSSI POSSONO ESSERE ANCHE NEGATIVI SONO SEMPRE CONSIDERATI NETTI |
131 | 131 |
132 return args | 132 return args |
133 | 133 |
134 ############################ dataset input #################################### | 134 ############################ dataset input #################################### |
135 def read_dataset(data :str, name :str) -> pd.DataFrame: | 135 def read_dataset(data :str, name :str) -> pd.DataFrame: |
250 core_map : mut | 250 core_map : mut |
251 """ | 251 """ |
252 maxT = 12 | 252 maxT = 12 |
253 minT = 2 | 253 minT = 2 |
254 grey = '#BEBEBE' | 254 grey = '#BEBEBE' |
255 blue = '#6495ed' | 255 blue = '#6495ed' # azzurrino |
256 red = '#ecac68' | 256 red = '#ecac68' # arancione |
257 for el in core_map.iter(): | 257 for el in core_map.iter(): |
258 el_id = str(el.get('id')) | 258 el_id = str(el.get('id')) |
259 if el_id.startswith('R_'): | 259 if el_id.startswith('R_'): |
260 tmp = d.get(el_id[2:]) | 260 tmp = d.get(el_id[2:]) |
261 if tmp != None: | 261 if tmp != None: |
493 if not math.isinf(foldChange): | 493 if not math.isinf(foldChange): |
494 try: | 494 try: |
495 width = max(abs(z_score * Arrow.MAX_W) / maxNumericZScore, Arrow.MIN_W) | 495 width = max(abs(z_score * Arrow.MAX_W) / maxNumericZScore, Arrow.MIN_W) |
496 | 496 |
497 except ZeroDivisionError: pass | 497 except ZeroDivisionError: pass |
498 | 498 # TODO CHECK RV |
499 #if not reactionId.endswith("_RV"): # RV stands for reversible reactions | 499 #if not reactionId.endswith("_RV"): # RV stands for reversible reactions |
500 # Arrow(width, ArrowColor.fromFoldChangeSign(foldChange)).styleReactionElements(metabMap, reactionId) | 500 # Arrow(width, ArrowColor.fromFoldChangeSign(foldChange)).styleReactionElements(metabMap, reactionId) |
501 # continue | 501 # continue |
502 | 502 |
503 #reactionId = reactionId[:-3] # Remove "_RV" | 503 #reactionId = reactionId[:-3] # Remove "_RV" |
512 # vvv These 2 if statements can both be true and can both happen | 512 # vvv These 2 if statements can both be true and can both happen |
513 if ARGS.net: # style arrow head(s): | 513 if ARGS.net: # style arrow head(s): |
514 arrow.styleReactionElements(metabMap, reactionId + ("_B" if inversionScore == 2 else "_F")) | 514 arrow.styleReactionElements(metabMap, reactionId + ("_B" if inversionScore == 2 else "_F")) |
515 arrow.applyTo(("F_" if inversionScore == 2 else "B_") + reactionId, metabMap, f";stroke:{ArrowColor.Transparent};stroke-width:0;stroke-dasharray:None") | 515 arrow.applyTo(("F_" if inversionScore == 2 else "B_") + reactionId, metabMap, f";stroke:{ArrowColor.Transparent};stroke-width:0;stroke-dasharray:None") |
516 | 516 |
517 arrow.styleReactionElements(metabMap, reactionId, mindReactionDir = False) | 517 arrow.styleReactionElements(metabMap, reactionId, mindReactionDir = True) |
518 | 518 |
519 | 519 |
520 ############################ split class ###################################### | 520 ############################ split class ###################################### |
521 def split_class(classes :pd.DataFrame, resolve_rules :Dict[str, List[float]]) -> Dict[str, List[List[float]]]: | 521 def split_class(classes :pd.DataFrame, resolve_rules :Dict[str, List[float]]) -> Dict[str, List[List[float]]]: |
522 """ | 522 """ |