1 import sets
2 import SloppyCell.ExprManip as ExprManip
3
5 - def __init__(self, id, stoichiometry, kineticLaw = '', name = '',
6 reactant_stoichiometry = None, product_stoichiometry = None):
7 self.id = id
8 self.stoichiometry = stoichiometry
9
10
11
12 self.reactant_stoichiometry = reactant_stoichiometry
13 self.product_stoichiometry = product_stoichiometry
14 self.kineticLaw = kineticLaw
15 self.name = name
16
17 variables = ExprManip.extract_vars(kineticLaw)
18 self.parameters = variables.difference(sets.Set(stoichiometry.keys()))
19
21 return self.__class__ == other.__class__ and \
22 self.kineticLaw == other.kineticLaw and \
23 self.stoichiometry == other.stoichiometry
24
26 return not (self == other)
27
29 oldStoichiometry = self.stoichiometry
30 self.stoichiometry = {}
31 for base in oldStoichiometry:
32 self.stoichiometry[kwargs[base]] = oldStoichiometry[base]
33
34 self.kineticLaw = ExprManip.sub_for_vars(self.kineticLaw, kwargs)
35
37 """
38 Change stoichiometry will update self.stoichiometry.
39 It also updates self.reactant_stoichiometry and self.product_stoichiometry,
40 if they are defined, to keep the two stoichiometry tracking systems in sync.
41 """
42 self.stoichiometry[species] = stoich
43 if self.reactant_stoichiometry != None and self.product_stoichiometry != None:
44 if species in self.reactant_stoichiometry.keys():
45 del self.reactant_stoichiometry[species]
46 self.product_stoichiometry[species] = [stoich]
47
48
51 self.kineticLaw = 'rate * reactant**2'
52 self.stoichiometry = {'reactant': -2,
53 'dimer': +1}
54 self.doKwargsSubstitution(kwargs)
55 Reaction.__init__(self, id, self.stoichiometry, self.kineticLaw)
56
59 self.kineticLaw = 'rate * A * B'
60 self.stoichiometry = {'A': -1,
61 'B': -1,
62 'dimer': +1}
63 self.doKwargsSubstitution(kwargs)
64 Reaction.__init__(self, id, self.stoichiometry, self.kineticLaw)
65
68 self.kineticLaw = 'rate * dimer'
69 self.stoichiometry = {'reactant': +2,
70 'dimer': -1}
71 self.doKwargsSubstitution(kwargs)
72 Reaction.__init__(self, id, self.stoichiometry, self.kineticLaw)
73
76 self.kineticLaw = 'rate * dimer'
77 self.stoichiometry = {'A': +1,
78 'B': +1,
79 'dimer': -1}
80 self.doKwargsSubstitution(kwargs)
81 Reaction.__init__(self, id, self.stoichiometry, self.kineticLaw)
82
85 self.kineticLaw = 'rate * species'
86 self.stoichiometry = {'species': -1}
87 self.doKwargsSubstitution(kwargs)
88 Reaction.__init__(self, id, self.stoichiometry, self.kineticLaw)
89
92 self.kineticLaw = 'k * E * S / (S + Km)'
93 self.stoichiometry = {'E': 0,
94 'S': -1,
95 'P': 1}
96 self.doKwargsSubstitution(kwargs)
97 Reaction.__init__(self, id, self.stoichiometry, self.kineticLaw)
98
101 self.kineticLaw = 'rate * template'
102 self.stoichiometry = {'product': 1,
103 'template': 0}
104 self.doKwargsSubstitution(kwargs)
105 Reaction.__init__(self, id, self.stoichiometry, self.kineticLaw)
106
114
121
131
141
144 self.kineticLaw = 'k * S / (S + Km)'
145 self.stoichiometry = {'S': -1}
146 self.doKwargsSubstitution(kwargs)
147 Reaction.__init__(self, id, self.stoichiometry, self.kineticLaw)
148
151 self.kineticLaw = 'k * S / (S + Km)'
152 self.stoichiometry = {'S': -1,
153 'P': +1}
154 self.doKwargsSubstitution(kwargs)
155 Reaction.__init__(self, id, self.stoichiometry, self.kineticLaw)
156
159 self.kineticLaw = 'rate * reactant'
160 self.stoichiometry = {'product': 1,
161 'reactant': -1}
162 self.doKwargsSubstitution(kwargs)
163 Reaction.__init__(self, id, self.stoichiometry, self.kineticLaw)
164
167 self.kineticLaw = 'rate * reactant'
168 self.stoichiometry = {'product_1': 1,
169 'product_2': 1,
170 'reactant': -1}
171 self.doKwargsSubstitution(kwargs)
172 Reaction.__init__(self, id, self.stoichiometry, self.kineticLaw)
173
176 self.kineticLaw = 'rate * reactant_1 * reactant_2'
177 self.stoichiometry = {'product': 1,
178 'reactant_1': -1,
179 'reactant_2': -1}
180 self.doKwargsSubstitution(kwargs)
181 Reaction.__init__(self, id, self.stoichiometry, self.kineticLaw)
182
185 self.kineticLaw = 'vmax * (S**h) / ((Km**h) + (S**h))'
186 self.stoichiometry = {'S': -1}
187 self.doKwargsSubstitution(kwargs)
188 Reaction.__init__(self, id, self.stoichiometry, self.kineticLaw)
189
192 self.kineticLaw = 'vmax * (S**h) / ((Km**h) + (S**h))'
193 self.stoichiometry = {'S': -1,
194 'P': +1}
195 self.doKwargsSubstitution(kwargs)
196 Reaction.__init__(self, id, self.stoichiometry, self.kineticLaw)
197