comparison COBRAxy/flux_to_map.py @ 186:f0197057876c draft

Uploaded
author francesco_lapi
date Wed, 20 Nov 2024 17:35:25 +0000
parents c933b2c6a39e
children 5581ce89f15e
comparison
equal deleted inserted replaced
185:c933b2c6a39e 186:f0197057876c
329 return ReactionDirection.fromDir(reactionId[-2:]) 329 return ReactionDirection.fromDir(reactionId[-2:])
330 330
331 def getArrowBodyElementId(reactionId :str) -> str: 331 def getArrowBodyElementId(reactionId :str) -> str:
332 if reactionId.endswith("_RV"): reactionId = reactionId[:-3] #TODO: standardize _RV 332 if reactionId.endswith("_RV"): reactionId = reactionId[:-3] #TODO: standardize _RV
333 elif ReactionDirection.fromReactionId(reactionId) is not ReactionDirection.Unknown: reactionId = reactionId[:-2] 333 elif ReactionDirection.fromReactionId(reactionId) is not ReactionDirection.Unknown: reactionId = reactionId[:-2]
334 if 'r1050' in reactionId:
335 print(reactionId)
334 return f"R_{reactionId}" 336 return f"R_{reactionId}"
335 337
336 def getArrowHeadElementId(reactionId :str) -> Tuple[str, str]: 338 def getArrowHeadElementId(reactionId :str) -> Tuple[str, str]:
337 """ 339 """
338 We attempt extracting the direction information from the provided reaction ID, if unsuccessful we provide the IDs of both directions. 340 We attempt extracting the direction information from the provided reaction ID, if unsuccessful we provide the IDs of both directions.
512 # vvv These 2 if statements can both be true and can both happen 514 # vvv These 2 if statements can both be true and can both happen
513 if ARGS.net: # style arrow head(s): 515 if ARGS.net: # style arrow head(s):
514 arrow.styleReactionElements(metabMap, reactionId + ("_B" if inversionScore == 2 else "_F")) 516 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") 517 arrow.applyTo(("F_" if inversionScore == 2 else "B_") + reactionId, metabMap, f";stroke:{ArrowColor.Transparent};stroke-width:0;stroke-dasharray:None")
516 518
517 arrow.styleReactionElements(metabMap, reactionId, mindReactionDir = True) 519 arrow.styleReactionElements(metabMap, reactionId, mindReactionDir = False)
518 520
519 521
520 ############################ split class ###################################### 522 ############################ split class ######################################
521 def split_class(classes :pd.DataFrame, resolve_rules :Dict[str, List[float]]) -> Dict[str, List[List[float]]]: 523 def split_class(classes :pd.DataFrame, resolve_rules :Dict[str, List[float]]) -> Dict[str, List[List[float]]]:
522 """ 524 """