Coverage for colour/biochemistry/michaelis_menten.py: 100%

48 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-11-16 23:01 +1300

1""" 

2Michaelis-Menten Kinetics 

3========================= 

4 

5Define the *Michaelis-Menten* kinetics model for enzyme-catalyzed reactions, 

6describing the relationship between reaction rate and substrate concentration: 

7 

8- :func:`colour.biochemistry.reaction_rate_MichaelisMenten_Michaelis1913` 

9- :func:`colour.biochemistry.reaction_rate_MichaelisMenten_Abebe2017` 

10- :func:`colour.biochemistry.REACTION_RATE_MICHAELISMENTEN_METHODS` 

11- :func:`colour.biochemistry.reaction_rate_MichaelisMenten` 

12- :func:`colour.biochemistry.\ 

13substrate_concentration_MichaelisMenten_Michaelis1913` 

14- :func:`colour.biochemistry.\ 

15substrate_concentration_MichaelisMenten_Abebe2017` 

16- :func:`colour.biochemistry.SUBSTRATE_CONCENTRATION_MICHAELISMENTEN_METHODS` 

17- :func:`colour.biochemistry.substrate_concentration_MichaelisMenten` 

18 

19References 

20---------- 

21- :cite:`Abebe2017` : Abebe, M. A., Pouli, T., Larabi, M.-C., & Reinhard, 

22 E. (2017). Perceptual Lightness Modeling for High-Dynamic-Range Imaging. 

23 ACM Transactions on Applied Perception, 15(1), 1-19. doi:10.1145/3086577 

24- :cite:`Wikipedia2003d` : Wikipedia. (2003). Michaelis-Menten kinetics. 

25 Retrieved April 29, 2017, from 

26 https://en.wikipedia.org/wiki/Michaelis%E2%80%93Menten_kinetics 

27""" 

28 

29from __future__ import annotations 

30 

31import typing 

32 

33if typing.TYPE_CHECKING: 

34 from colour.hints import Any, ArrayLike, Literal, NDArrayFloat 

35 

36from colour.utilities import ( 

37 CanonicalMapping, 

38 as_float, 

39 as_float_array, 

40 filter_kwargs, 

41 validate_method, 

42) 

43 

44__author__ = "Colour Developers" 

45__copyright__ = "Copyright 2013 Colour Developers" 

46__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 

47__maintainer__ = "Colour Developers" 

48__email__ = "colour-developers@colour-science.org" 

49__status__ = "Production" 

50 

51__all__ = [ 

52 "reaction_rate_MichaelisMenten_Michaelis1913", 

53 "reaction_rate_MichaelisMenten_Abebe2017", 

54 "REACTION_RATE_MICHAELISMENTEN_METHODS", 

55 "reaction_rate_MichaelisMenten", 

56 "substrate_concentration_MichaelisMenten_Michaelis1913", 

57 "substrate_concentration_MichaelisMenten_Abebe2017", 

58 "SUBSTRATE_CONCENTRATION_MICHAELISMENTEN_METHODS", 

59 "substrate_concentration_MichaelisMenten", 

60] 

61 

62 

63def reaction_rate_MichaelisMenten_Michaelis1913( 

64 S: ArrayLike, 

65 V_max: ArrayLike, 

66 K_m: ArrayLike, 

67) -> NDArrayFloat: 

68 """ 

69 Compute the rate of enzymatic reactions by relating reaction rate 

70 :math:`v` to substrate concentration :math:`S` using the 

71 *Michaelis-Menten* kinetics equation. 

72 

73 Parameters 

74 ---------- 

75 S 

76 Substrate concentration :math:`S`. 

77 V_max 

78 Maximum reaction rate :math:`V_{max}` achieved by the system at 

79 saturating substrate concentration. 

80 K_m 

81 Michaelis constant :math:`K_m` representing the substrate 

82 concentration at which the reaction rate is half of 

83 :math:`V_{max}`. 

84 

85 Returns 

86 ------- 

87 :class:`numpy.ndarray` 

88 Reaction rate :math:`v`. 

89 

90 References 

91 ---------- 

92 :cite:`Wikipedia2003d` 

93 

94 Examples 

95 -------- 

96 >>> reaction_rate_MichaelisMenten(0.5, 2.5, 0.8) # doctest: +ELLIPSIS 

97 0.9615384... 

98 """ 

99 

100 S = as_float_array(S) 

101 V_max = as_float_array(V_max) 

102 K_m = as_float_array(K_m) 

103 

104 v = (V_max * S) / (K_m + S) 

105 

106 return as_float(v) 

107 

108 

109def reaction_rate_MichaelisMenten_Abebe2017( 

110 S: ArrayLike, 

111 V_max: ArrayLike, 

112 K_m: ArrayLike, 

113 b_m: ArrayLike, 

114) -> NDArrayFloat: 

115 """ 

116 Compute the rate of enzymatic reactions by relating reaction rate 

117 :math:`v` to the concentration of a substrate :math:`S` using the 

118 modified *Michaelis-Menten* kinetics equation as specified by *Abebe, 

119 Pouli, Larabi and Reinhard (2017)*. 

120 

121 Parameters 

122 ---------- 

123 S 

124 Concentration of a substrate :math:`S` (or 

125 :math:`(\\cfrac{Y}{Y_n})^{\\epsilon}`). 

126 V_max 

127 Maximum rate :math:`V_{max}` (or :math:`a_m`) achieved by the system 

128 at saturating substrate concentration. 

129 K_m 

130 Substrate concentration :math:`K_m` (or :math:`c_m`) at which the 

131 reaction rate is half of :math:`V_{max}`. 

132 b_m 

133 Bias factor :math:`b_m`. 

134 

135 Returns 

136 ------- 

137 :class:`numpy.ndarray` 

138 Reaction rate :math:`v`. 

139 

140 References 

141 ---------- 

142 :cite:`Abebe2017` 

143 

144 Examples 

145 -------- 

146 >>> reaction_rate_MichaelisMenten_Abebe2017(0.5, 1.448, 0.635, 0.813) 

147 ... # doctest: +ELLIPSIS 

148 0.6951512... 

149 """ 

150 

151 S = as_float_array(S) 

152 V_max = as_float_array(V_max) 

153 K_m = as_float_array(K_m) 

154 b_m = as_float_array(b_m) 

155 

156 v = (V_max * S) / (b_m * S + K_m) 

157 

158 return as_float(v) 

159 

160 

161REACTION_RATE_MICHAELISMENTEN_METHODS: CanonicalMapping = CanonicalMapping( 

162 { 

163 "Michaelis 1913": reaction_rate_MichaelisMenten_Michaelis1913, 

164 "Abebe 2017": reaction_rate_MichaelisMenten_Abebe2017, 

165 } 

166) 

167REACTION_RATE_MICHAELISMENTEN_METHODS.__doc__ = """ 

168Supported *Michaelis-Menten* kinetics reaction rate equation computation 

169methods. 

170 

171References 

172---------- 

173:cite:`Wikipedia2003d`, :cite:`Abebe2017` 

174""" 

175 

176 

177def reaction_rate_MichaelisMenten( 

178 S: ArrayLike, 

179 V_max: ArrayLike, 

180 K_m: ArrayLike, 

181 method: Literal["Michaelis 1913", "Abebe 2017"] | str = "Michaelis 1913", 

182 **kwargs: Any, 

183) -> NDArrayFloat: 

184 """ 

185 Compute the rate of enzymatic reactions by relating reaction rate 

186 :math:`v` to substrate concentration :math:`S` using the 

187 *Michaelis-Menten* kinetics equation using the specified method. 

188 

189 Parameters 

190 ---------- 

191 S 

192 Concentration of substrate :math:`S`. 

193 V_max 

194 Maximum reaction rate :math:`V_{max}` achieved at saturating substrate 

195 concentration. 

196 K_m 

197 Michaelis constant :math:`K_m` representing substrate concentration at 

198 which reaction rate equals half of :math:`V_{max}`. 

199 method 

200 Computation method. 

201 

202 Other Parameters 

203 ---------------- 

204 b_m 

205 {:func:`colour.biochemistry.reaction_rate_MichaelisMenten_Abebe2017`}, 

206 Bias factor :math:`b_m`. 

207 

208 Returns 

209 ------- 

210 :class:`numpy.ndarray` 

211 Reaction rate :math:`v`. 

212 

213 References 

214 ---------- 

215 :cite:`Wikipedia2003d`, :cite:`Abebe2017` 

216 

217 Examples 

218 -------- 

219 >>> reaction_rate_MichaelisMenten(0.5, 2.5, 0.8) # doctest: +ELLIPSIS 

220 0.9615384... 

221 >>> reaction_rate_MichaelisMenten( 

222 ... 0.5, 2.5, 0.8, method="Abebe 2017", b_m=0.813 

223 ... ) # doctest: +ELLIPSIS 

224 1.0360547... 

225 """ 

226 

227 method = validate_method(method, tuple(REACTION_RATE_MICHAELISMENTEN_METHODS)) 

228 

229 function = REACTION_RATE_MICHAELISMENTEN_METHODS[method] 

230 

231 return function(S, V_max, K_m, **filter_kwargs(function, **kwargs)) 

232 

233 

234def substrate_concentration_MichaelisMenten_Michaelis1913( 

235 v: ArrayLike, 

236 V_max: ArrayLike, 

237 K_m: ArrayLike, 

238) -> NDArrayFloat: 

239 """ 

240 Compute substrate concentration by relating the concentration of a 

241 substrate :math:`S` to the reaction rate :math:`v` using the 

242 *Michaelis-Menten* kinetics equation.. 

243 

244 Parameters 

245 ---------- 

246 v 

247 Reaction rate :math:`v`. 

248 V_max 

249 Maximum rate :math:`V_{max}` achieved by the system at saturating 

250 substrate concentration. 

251 K_m 

252 Substrate concentration :math:`K_m` at which the reaction rate is 

253 half of :math:`V_{max}`. 

254 

255 Returns 

256 ------- 

257 :class:`numpy.ndarray` 

258 Concentration of a substrate :math:`S`. 

259 

260 References 

261 ---------- 

262 :cite:`Wikipedia2003d` 

263 

264 Examples 

265 -------- 

266 >>> substrate_concentration_MichaelisMenten(0.961538461538461, 2.5, 0.8) 

267 ... # doctest: +ELLIPSIS 

268 0.4999999... 

269 """ 

270 

271 v = as_float_array(v) 

272 V_max = as_float_array(V_max) 

273 K_m = as_float_array(K_m) 

274 

275 S = (v * K_m) / (V_max - v) 

276 

277 return as_float(S) 

278 

279 

280def substrate_concentration_MichaelisMenten_Abebe2017( 

281 v: ArrayLike, 

282 V_max: ArrayLike, 

283 K_m: ArrayLike, 

284 b_m: ArrayLike, 

285) -> NDArrayFloat: 

286 """ 

287 Compute substrate concentration by relating the concentration of a 

288 substrate :math:`S` to the reaction rate :math:`v` using the 

289 *Michaelis-Menten* kinetics equation as specified by *Abebe, Pouli, Larabi 

290 and Reinhard (2017)*. 

291 

292 Parameters 

293 ---------- 

294 v 

295 Reaction rate :math:`v`. 

296 V_max 

297 Maximum rate :math:`V_{max}` (or :math:`a_m`) achieved by the system 

298 at saturating substrate concentration. 

299 K_m 

300 Substrate concentration :math:`K_m` (or :math:`c_m`) at which the 

301 reaction rate is half of :math:`V_{max}`. 

302 b_m 

303 Bias factor :math:`b_m`. 

304 

305 Returns 

306 ------- 

307 :class:`numpy.ndarray` 

308 Concentration of a substrate :math:`S`. 

309 

310 References 

311 ---------- 

312 :cite:`Abebe2017` 

313 

314 Examples 

315 -------- 

316 >>> substrate_concentration_MichaelisMenten_Abebe2017( 

317 ... 0.695151224195871, 1.448, 0.635, 0.813 

318 ... ) # doctest: +ELLIPSIS 

319 0.4999999... 

320 """ 

321 

322 v = as_float_array(v) 

323 V_max = as_float_array(V_max) 

324 K_m = as_float_array(K_m) 

325 b_m = as_float_array(b_m) 

326 

327 S = (v * K_m) / (V_max - b_m * v) 

328 

329 return as_float(S) 

330 

331 

332SUBSTRATE_CONCENTRATION_MICHAELISMENTEN_METHODS: CanonicalMapping = CanonicalMapping( 

333 { 

334 "Michaelis 1913": substrate_concentration_MichaelisMenten_Michaelis1913, 

335 "Abebe 2017": substrate_concentration_MichaelisMenten_Abebe2017, 

336 } 

337) 

338SUBSTRATE_CONCENTRATION_MICHAELISMENTEN_METHODS.__doc__ = """ 

339Supported *Michaelis-Menten* kinetics substrate concentration equation 

340computation methods. 

341 

342References 

343---------- 

344:cite:`Wikipedia2003d`, :cite:`Abebe2017` 

345""" 

346 

347 

348def substrate_concentration_MichaelisMenten( 

349 v: ArrayLike, 

350 V_max: ArrayLike, 

351 K_m: ArrayLike, 

352 method: Literal["Michaelis 1913", "Abebe 2017"] | str = "Michaelis 1913", 

353 **kwargs: Any, 

354) -> NDArrayFloat: 

355 """ 

356 Compute substrate concentration by relating the concentration of a 

357 substrate :math:`S` to the reaction rate :math:`v` using the 

358 *Michaelis-Menten* kinetics equation using the specified method. 

359 

360 Parameters 

361 ---------- 

362 v 

363 Reaction rate :math:`v`. 

364 V_max 

365 Maximum rate :math:`V_{max}` achieved by the system at saturating 

366 substrate concentration. 

367 K_m 

368 Substrate concentration :math:`K_m` at which the reaction rate is 

369 half of :math:`V_{max}`. 

370 method 

371 Computation method. 

372 

373 Other Parameters 

374 ---------------- 

375 b_m 

376 {:func:`colour.biochemistry.\ 

377substrate_concentration_MichaelisMenten_Abebe2017`}, 

378 Bias factor :math:`b_m`. 

379 

380 Returns 

381 ------- 

382 :class:`numpy.ndarray` 

383 Concentration of a substrate :math:`S`. 

384 

385 References 

386 ---------- 

387 :cite:`Wikipedia2003d`, :cite:`Abebe2017` 

388 

389 Examples 

390 -------- 

391 >>> substrate_concentration_MichaelisMenten(0.961538461538461, 2.5, 0.8) 

392 ... # doctest: +ELLIPSIS 

393 0.4999999... 

394 >>> substrate_concentration_MichaelisMenten( 

395 ... 1.036054703688355, 2.5, 0.8, method="Abebe 2017", b_m=0.813 

396 ... ) 

397 ... # doctest: +ELLIPSIS 

398 0.5000000... 

399 """ 

400 

401 method = validate_method( 

402 method, tuple(SUBSTRATE_CONCENTRATION_MICHAELISMENTEN_METHODS) 

403 ) 

404 

405 function = SUBSTRATE_CONCENTRATION_MICHAELISMENTEN_METHODS[method] 

406 

407 return function(v, V_max, K_m, **filter_kwargs(function, **kwargs))