comparison COBRAxy/flux_to_map.py @ 187:5581ce89f15e draft

Uploaded
author francesco_lapi
date Wed, 20 Nov 2024 17:40:34 +0000
parents f0197057876c
children 68e5280198d7
comparison
equal deleted inserted replaced
186:f0197057876c 187:5581ce89f15e
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)
336 return f"R_{reactionId}" 334 return f"R_{reactionId}"
337 335
338 def getArrowHeadElementId(reactionId :str) -> Tuple[str, str]: 336 def getArrowHeadElementId(reactionId :str) -> Tuple[str, str]:
339 """ 337 """
340 We attempt extracting the direction information from the provided reaction ID, if unsuccessful we provide the IDs of both directions. 338 We attempt extracting the direction information from the provided reaction ID, if unsuccessful we provide the IDs of both directions.
400 if getElementById(reactionId, metabMap).map(lambda el : styleMapElement(el, styleStr)).isErr: 398 if getElementById(reactionId, metabMap).map(lambda el : styleMapElement(el, styleStr)).isErr:
401 ERRORS.append(reactionId) 399 ERRORS.append(reactionId)
402 400
403 def styleReactionElements(self, metabMap :ET.ElementTree, reactionId :str, *, mindReactionDir = True) -> None: 401 def styleReactionElements(self, metabMap :ET.ElementTree, reactionId :str, *, mindReactionDir = True) -> None:
404 if not mindReactionDir: 402 if not mindReactionDir:
403 if 'r1050' in reactionId:
404 print(reactionId)
405 print(self.toStyleStr())
405 return self.applyTo(getArrowBodyElementId(reactionId), metabMap, self.toStyleStr()) 406 return self.applyTo(getArrowBodyElementId(reactionId), metabMap, self.toStyleStr())
406 407
407 # Now we style the arrow head(s): 408 # Now we style the arrow head(s):
408 idOpt1, idOpt2 = getArrowHeadElementId(reactionId) 409 idOpt1, idOpt2 = getArrowHeadElementId(reactionId)
409 self.applyTo(idOpt1, metabMap, self.toStyleStr(downSizedForTips = True)) 410 self.applyTo(idOpt1, metabMap, self.toStyleStr(downSizedForTips = True))