Skip to content

Commit

Permalink
Merge pull request #229 from jonls/sbml-flux-bound-constants
Browse files Browse the repository at this point in the history
sbml: Extend FluxBoundObjective with constants
  • Loading branch information
jonls committed Apr 14, 2017
2 parents c4c5308 + 2d2ec6b commit 34cc181
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion psamm/datasource/sbml.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,10 @@ def reactions(self):
class FluxBoundEntry(object):
"""Flux bound defined with FBC"""

LESS_EQUAL = 'lessEqual'
GREATER_EQUAL = 'greaterEqual'
EQUAL = 'equal'

def __init__(self, reader, namespace, root):
self._reader = reader
self._root = root
Expand All @@ -475,7 +479,8 @@ def __init__(self, reader, namespace, root):
self._operation = self._root.get(_tag('operation', self._namespace))
if self._operation is None:
raise ParseError('Flux bound is missing "operation" attribute')
elif self._operation not in ('lessEqual', 'greaterEqual', 'equal'):
elif self._operation not in {
self.LESS_EQUAL, self.GREATER_EQUAL, self.EQUAL}:
raise ParseError('Invalid flux bound operation: {}'.format(
self._operation))

Expand All @@ -489,22 +494,30 @@ def __init__(self, reader, namespace, root):

@property
def id(self):
"""Return ID of flux bound."""
return self._id

@property
def name(self):
"""Return name of flux bound."""
return self._name

@property
def reaction(self):
"""Return reaction ID that the flux bound pertains to."""
return self._reaction

@property
def operation(self):
"""Return the operation of the flux bound.
Returns one of LESS_EQUAL, GREATER_EQUAL or EQUAL.
"""
return self._operation

@property
def value(self):
"""Return the flux bound value."""
return self._value


Expand Down

0 comments on commit 34cc181

Please sign in to comment.