19
19
20
20
Author: Brett G. Olivier
21
21
Contact email: bgoli@users.sourceforge.net
22
- Last edit: $Author: bgoli $ ($Id: CBModel.py 695 2019-07-26 15:05:45Z bgoli $)
22
+ Last edit: $Author: bgoli $ ($Id: CBModel.py 696 2019-07-29 21:59:43Z bgoli $)
23
23
24
24
"""
25
25
## gets rid of "invalid variable name" info
@@ -3878,8 +3878,8 @@ def setValue(self, value):
3878
3878
self .value = float (value )
3879
3879
3880
3880
3881
- class FluxBoundNew (Fbase ):
3882
- """A refactored and streamlined FluxBound object """
3881
+ class FluxBoundBase (Fbase ):
3882
+ """A refactored and streamlined FluxBound base class that can be a generic bound, superclass to FluxBoundUpper and FluxBoundLower """
3883
3883
3884
3884
_parent = None
3885
3885
operator = None
@@ -3899,23 +3899,19 @@ def __init__(self, pid, operator, value, parent=None):
3899
3899
if parent is Reaction or parent is None :
3900
3900
self ._parent = parent
3901
3901
else :
3902
- print ("Invalid parent object: " + str (parent ))
3903
- return False
3902
+ raise RuntimeError ("Invalid parent object: " + str (parent ))
3904
3903
3905
3904
if self .operator in ['greater' , 'greaterEqual' , '>=' , 'G' , 'GE' ]:
3906
3905
self .operator = '>='
3907
3906
elif self .operator in ['less' , 'lessEqual' , '<=' , 'L' , 'LE' ]:
3908
3907
self .operator = '<='
3909
3908
else :
3910
- print ('Invalid operator: ' + operator )
3911
- return False
3909
+ raise RuntimeError ('Invalid operator: ' + operator )
3912
3910
3913
3911
self .setValue (value )
3914
-
3915
3912
self .annotation = {}
3916
3913
self .compartment = None
3917
3914
#self.__delattr__('compartment')
3918
- return True
3919
3915
3920
3916
def getType (self ):
3921
3917
"""
@@ -3953,6 +3949,41 @@ def setValue(self, value):
3953
3949
return False
3954
3950
return True
3955
3951
3952
+ class FluxBoundUpper (FluxBoundBase ):
3953
+ def __init__ (self , reaction , value = numpy .inf ):
3954
+ """
3955
+ Upper Bound class, less flexible than generic superclass (no input checking) for model instantiation.
3956
+
3957
+ - *value* [default=inf] a float
3958
+ - *reaction* the parent Reaction
3959
+
3960
+ """
3961
+ self .setId ('{}_upper_bnd' .format (reaction .getId ()))
3962
+ self .operator = '<='
3963
+ self .setValue (value )
3964
+ self ._parent = reaction
3965
+ self .annotation = {}
3966
+ self .compartment = None
3967
+ #self.__delattr__('compartment')
3968
+
3969
+
3970
+ class FluxBoundLower (FluxBoundBase ):
3971
+ def __init__ (self , reaction , value = numpy .NINF ):
3972
+ """
3973
+ Lower Bound Class, less flexible than generic superclass (no input checking) for model instantiation.
3974
+
3975
+ - *value* [default=-inf] a float
3976
+ - *reaction* the parent Reaction
3977
+
3978
+ """
3979
+ self .setId ('{}_lower_bnd' .format (reaction .getId ()))
3980
+ self .operator = '>='
3981
+ self .setValue (value )
3982
+ self ._parent = reaction
3983
+ self .annotation = {}
3984
+ self .compartment = None
3985
+ #self.__delattr__('compartment')
3986
+
3956
3987
3957
3988
class Parameter (Fbase ):
3958
3989
"""Holds parameter information"""
0 commit comments