From 733faa9030f3c540c3f5e1774fb9cf52859451f7 Mon Sep 17 00:00:00 2001 From: Ebunoluwa Makinde <ebunoluwa.makinde@ucalgary.ca> Date: Wed, 12 Oct 2022 07:17:27 +0000 Subject: [PATCH] Upload New File --- ..._bc_production_dependent_on_glucose__2_.py | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 Co-culture Model/co_culture_model_version_4_1_bc_production_dependent_on_glucose__2_.py diff --git a/Co-culture Model/co_culture_model_version_4_1_bc_production_dependent_on_glucose__2_.py b/Co-culture Model/co_culture_model_version_4_1_bc_production_dependent_on_glucose__2_.py new file mode 100644 index 0000000..92ab491 --- /dev/null +++ b/Co-culture Model/co_culture_model_version_4_1_bc_production_dependent_on_glucose__2_.py @@ -0,0 +1,125 @@ +# -*- coding: utf-8 -*- +"""Co-culture model version 4.1 - BC production dependent on glucose + +Automatically generated by Colaboratory. + +Original file is located at + https://colab.research.google.com/drive/1Hf6h8JPN_b7t5grQnsR6pauO-vJLxLQP + +### This section calls all the imports and defines the equations +""" + +# Commented out IPython magic to ensure Python compatibility. +#Import the necessary packages +from gc import collect +# %matplotlib inline + +import math as math +import numpy as np +import matplotlib.pyplot as plt +from scipy.integrate import odeint + +# parameter values +#mumax_xyl = 0.048 # 1/hour +#literature value +mumax_c = 0.019 # 1/hour +Ksxyl = 20 # g/liter +Si = 20 # g/liter + +mumax_col = 0.55 # 1/hour +Kscol = 0.0024 # g/liter +Yxscol = 0.38 # g/g + +Ypxgluc = 7.62 # g/g +Ypxace = 1.15 # g/g +Yxsbc = 0.24 # g/g + +# reaction rates +def mu(S,Ks,mumax): + return mumax*S/(Ks + S) + +# differential equations +def xdot(x,t): + BC,Xcol,S, Ace, Gluc= x + dBC = BC*mu(S,Ksxyl,mumax_c) + dXcol = Xcol*mu(S,Kscol,mumax_col) + dS = -((BC*mu(S,Ksxyl,mumax_c))/Yxsbc + (Xcol*mu(S,Kscol,mumax_col))/Yxscol) + dAce = Ypxace*BC*mu(S,Ksxyl,mumax_c) + dGluc = Ypxgluc*BC*mu(S,Ksxyl,mumax_c) + return [dBC,dXcol,dS,dAce,dGluc] + +"""### Simulation Results""" + +IC = [0.46, 0.054, 20,0,0] #K. xylinus, E. Coli, Substrate + +t = np.linspace(0,7,250) +sol = odeint(xdot,IC,t) +BC,Xcol,S,Ace,Gluc = sol.transpose() + +plt.plot(t,S) + +plt.xlabel('Time [hr]') +plt.ylabel('Concentration [g/liter]') +plt.title('Concentration of Glucose vs. Time') + +plt.plot(t,BC) +plt.plot(t,Xcol) +plt.xlabel('Time [hr]') +plt.ylabel('Concentration [g/liter]') +plt.legend(['BC Conc.', + 'E. coli Conc.']) + +plt.plot(t,Ace) +plt.plot(t,Gluc) +plt.xlabel('Time [hr]') +plt.ylabel('Concentration [g/liter]') +plt.legend(['Acetic Acid', + 'Gluconic Acid']) + +"""## Modelling pH change as a result of production of gluconic and acetic acid""" + +def get_ace_H_ions(): + Ace_in_M = [] + Ka = 1.75*(10**(-5)) + h_ions_Ace = [] + for i in range(len(Ace)): + Ace_in_M.append(Ace[i]/60.052) #convert from g/L to M + h_ions = math.sqrt(Ka*Ace_in_M[i]) + h_ions_Ace.append(h_ions) + return h_ions_Ace + +def get_gluc_H_ions(): + Gluc_in_M = [] + Ka = 2.5*(10**(-4)) + h_ions_Gluc = [] + for i in range(len(Gluc)): + Gluc_in_M.append(Gluc[i]/196.16) #convert from g/L to M + h_ions = math.sqrt(Ka*Gluc_in_M[i]) + h_ions_Gluc.append(h_ions) + return h_ions_Gluc + +#pHGluc.append(-1*np.log(h_ions)) + +init_h_ion = 1.0*(10**(-5)) +h_ions_ace = get_ace_H_ions() +h_ions_gluc = get_gluc_H_ions() +h_ions = [] +for i in range(len(h_ions_ace)): + h_ions.append(h_ions_ace[i]+h_ions_gluc[i]+init_h_ion) + +print(h_ions_ace) +print(h_ions_gluc) +print(h_ions) +def pH(h_ions): + pH = [] + for i in range(len(h_ions)): + if(h_ions[i]!=0): + pH.append(-1*math.log(h_ions[i],10)) + else: + pH.append(14) + return pH + +plt.plot(t,pH(h_ions)) +plt.xlabel('Time [hr]') +plt.ylabel('pH') +plt.legend(['pH ']) \ No newline at end of file -- GitLab