Skip to content

Commit

Permalink
fixing warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jonrkarr committed Sep 20, 2018
1 parent f9ceb87 commit 11b881e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def get_y_data(model, speciesCounts, speciesCompartmentId):
yData
"""

match = re.match('^(?P<speciesId>[a-z0-9\-_]+)\[(?P<compartmentId>[a-z0-9\-_]+)\]$', speciesCompartmentId, re.I).groupdict()
match = re.match(r'^(?P<speciesId>[a-z0-9\-_]+)\[(?P<compartmentId>[a-z0-9\-_]+)\]$', speciesCompartmentId, re.I).groupdict()
speciesId = match['speciesId']
compartmentId = match['compartmentId']

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ def parseStoichiometry(rxnStr):
# Parse a string representing the stoichiometry of a reaction into a Python object

# Split stoichiometry in to global compartment, left-hand side, right-hand side, reversibility indictor
rxnMatch = re.match('(?P<compartment>\[([a-z])\]: )?(?P<lhs>((\(\d*\.?\d*([e][-+]?[0-9]+)?\) )?[a-z0-9\-_]+(\[[a-z]\])? \+ )*(\(\d*\.?\d*([e][-+]?[0-9]+)?\) )?[a-z0-9\-_]+(\[[a-z]\])?) (?P<direction>[<]?)==> (?P<rhs>((\(\d*\.?\d*([e][-+]?[0-9]+)?\) )?[a-z0-9\-_]+(\[[a-z]\])? \+ )*(\(\d*\.?\d*([e][-+]?[0-9]+)?\) )?[a-z0-9\-_]+(\[[a-z]\])?)', rxnStr, flags=re.I)
rxnMatch = re.match(r'(?P<compartment>\[([a-z])\]: )?(?P<lhs>((\(\d*\.?\d*([e][-+]?[0-9]+)?\) )?[a-z0-9\-_]+(\[[a-z]\])? \+ )*(\(\d*\.?\d*([e][-+]?[0-9]+)?\) )?[a-z0-9\-_]+(\[[a-z]\])?) (?P<direction>[<]?)==> (?P<rhs>((\(\d*\.?\d*([e][-+]?[0-9]+)?\) )?[a-z0-9\-_]+(\[[a-z]\])? \+ )*(\(\d*\.?\d*([e][-+]?[0-9]+)?\) )?[a-z0-9\-_]+(\[[a-z]\])?)', rxnStr, flags=re.I)
if rxnMatch is None:
raise ValueError('Invalid stoichiometry: %s' % rxnStr)

Expand All @@ -875,15 +875,15 @@ def parseStoichiometry(rxnStr):
if rxnDict['compartment'] is None:
globalComp = None
else:
globalComp = re.match('\[(?P<compartment>[a-z])\]', rxnDict['compartment'], flags=re.I).groupdict()['compartment']
globalComp = re.match(r'\[(?P<compartment>[a-z])\]', rxnDict['compartment'], flags=re.I).groupdict()['compartment']

# initialize array of reaction participants
participants = []

# Parse left-hand side
for rxnPartStr in rxnDict['lhs'].split(' + '):
rxnPartDict = re.match(
'(\((?P<coefficient>\d*\.?\d*([e][-+]?[0-9]+)?)\) )?(?P<species>[a-z0-9\-_]+)(\[(?P<compartment>[a-z])\])?', rxnPartStr, flags=re.I).groupdict()
r'(\((?P<coefficient>\d*\.?\d*([e][-+]?[0-9]+)?)\) )?(?P<species>[a-z0-9\-_]+)(\[(?P<compartment>[a-z])\])?', rxnPartStr, flags=re.I).groupdict()

species = rxnPartDict['species']
compartment = rxnPartDict['compartment'] or globalComp
Expand All @@ -898,7 +898,7 @@ def parseStoichiometry(rxnStr):
# Parse right-hand side
for rxnPartStr in rxnDict['rhs'].split(' + '):
rxnPartDict = re.match(
'(\((?P<coefficient>\d*\.?\d*([e][-+]?[0-9]+)?)\) )?(?P<species>[a-z0-9\-_]+)(\[(?P<compartment>[a-z])\])?', rxnPartStr, flags=re.I).groupdict()
r'(\((?P<coefficient>\d*\.?\d*([e][-+]?[0-9]+)?)\) )?(?P<species>[a-z0-9\-_]+)(\[(?P<compartment>[a-z])\])?', rxnPartStr, flags=re.I).groupdict()

species = rxnPartDict['species']
compartment = rxnPartDict['compartment'] or globalComp
Expand Down

0 comments on commit 11b881e

Please sign in to comment.