-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEnzymeKineticsInR.R
343 lines (293 loc) · 16.9 KB
/
EnzymeKineticsInR.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
library(tidyverse)
library(grid)
library(gridExtra)
library(propagate)
library(broom)
# Loading data
########## Protein Concentration ##########
ProteinConc = read_csv("./Protein/data/ProteinConcentrationOptimization.csv")
# ProteinConc = read_csv("ProteinConcentrationOptimization.csv")
df1 <- pivot_longer(ProteinConc, cols = "No Protein":"1400 nM", names_to = "Concentrations",
values_to = "OD")
df1$Concentrations <- factor(df1$Concentrations,
levels = c("No Protein", "No NADH", "10 nM", "20 nM", "100 nM", "200 nM",
"400 nM", "600 nM", "800 nM", "1000 nM", "1200 nM", "1400 nM"))
ProteinConcPlot <- ggplot(df1, aes(Time, OD, color= Concentrations, shape = Concentrations)) +
# theme_bw() +
geom_point(size = 2, stroke = 2) +
scale_fill_viridis_d(option = "plasma") +
# theme_classic() +
# scale_colour_pander() +
scale_shape_manual(name = "Concentrations", values=1:nlevels(as.factor(df1$Concentrations))) +
# scale_color_manual(name = "Concentrations", values=1:nlevels(as.factor(df1$Concentrations))) +
labs(x = "Time (minutes)", y = expression(paste("Absorbance (OD"["340"], ")", sep = "")),
title = "", tag = "A") +
scale_x_continuous(breaks = seq(0, 60, 10)) +
scale_y_continuous(breaks = seq(0, 0.7, 0.1)) +
theme(panel.grid.major = element_line(size = 0.5, color = "grey"),
plot.title = element_text(hjust = 0.5),
axis.line = element_line(size = 0.7, color = "black"),
text = element_text(size = 24),
axis.text = element_text(angle=0, vjust=0.5, size=18, face = "bold"),
axis.text.x = element_text(angle = 45, hjust = 1),
panel.background = element_rect(fill = "grey85",
size = 0.5, linetype = "solid"),
axis.ticks = element_line(size = 0.5, colour = "black"))
# ggsave(filename = "Protein/Figures/ProteinConcPlot.jpg", width = 30, height = 20, units = "cm", dpi = 600)
########## pH Optimization ##########
pHData = read_csv("./Protein/data/pHOptimization.csv")
# pHData = read_csv("pHOptimization.csv")
dfpHData <- pivot_longer(pHData, cols = "No Protein":"pH 8.5", names_to = "pH",
values_to = "OD")
dfpHData$pH <- factor(dfpHData$pH,
levels = c("No Protein", "No NADH", "pH 3.0", "pH 4.0",
"pH 5.0", "pH 6.0", "pH 6.5", "pH 7.0", "pH 7.5", "pH 8.0", "pH 8.5"))
# pHPlot = ggplot(dfpHData, aes(Time, OD, color= pH, shape = pH)) +
# theme_bw() +
# geom_point(size = 1.5) +
# theme_classic() +
# scale_shape_manual(values=1:nlevels(as.factor(dfpHData$pH))) +
# labs(x = "Time (minutes)", y = expression("OD"[340]),
# title = "pH optimization", tag = "B") +
# theme(panel.grid.major = element_line(size = 0.5, color = "grey"),
# plot.title = element_text(hjust = 0.5),
# axis.line = element_line(size = 0.7, color = "black"),
# text = element_text(size = 16),
# axis.text = element_text(angle=0, vjust=0.5, size=16, face = "bold"))
pHDataPlot <- ggplot(dfpHData, aes(Time, OD, color = pH, shape = pH)) +
# theme_bw() +
geom_point(size = 2, stroke = 1.5) +
scale_fill_viridis_d(option = "plasma") +
# theme_classic() +
# scale_colour_pander() +
scale_shape_manual(name = "pH", values=1:nlevels(as.factor(dfpHData$pH))) +
scale_color_manual(name = "pH", values= c(1, 2, 3, 4, 10, 6, 7, 8, 9, 11, 12)) +
labs(x = "Time (minutes)", y = expression(paste("Absorbance (OD"["340"], ")", sep = "")),
title = "", tag = "B") +
scale_x_continuous(breaks = seq(0, 60, 10)) +
scale_y_continuous(breaks = seq(0, 0.7, 0.1)) +
theme(panel.grid.major = element_line(size = 0.5, color = "grey"),
plot.title = element_text(hjust = 0.5),
axis.line = element_line(size = 0.7, color = "black"),
text = element_text(size = 24),
axis.text = element_text(angle=0, vjust=0.5, size=18, face = "bold"),
axis.text.x = element_text(angle = 45, hjust = 1),
panel.background = element_rect(fill = "grey85",
size = 0.5, linetype = "solid"),
axis.ticks = element_line(size = 0.5, colour = "black"))
# ggsave(filename = "Protein/Figures/pHPlot.jpg", width = 30, height = 20, units = "cm", dpi = 600)
########## Temperature Optimization ##########
TempData = read_csv("./Protein/data/TempOptimization.csv")
# TempData = read_csv("TempOptimization.csv")
dfTempData <- pivot_longer(TempData, cols = "No Protein":"80 C", names_to = "Temperature",
values_to = "OD")
dfTempData$Temperature <- factor(dfTempData$Temperature,
levels = c("No Protein", "No NADH", "25 C", "30 C",
"37 C", "40 C", "45 C", "50 C", "55 C", "60 C", "65 C", "70 C", "80 C"))
# TempDataPlot = ggplot(dfTempData, aes(Time, OD, color = Temperature, shape = Temperature)) +
# theme_bw() +
# geom_point(size = 1.5) +
# theme_classic() +
# scale_shape_manual(name = "Temperature (°C)", values=1:nlevels(as.factor(dfTempData$Temperature))) +
# scale_color_manual(name = "Temperature (°C)", values=1:nlevels(as.factor(dfTempData$Temperature))) +
# labs(x = "Time (minutes)", y = expression("OD"[340]),
# title = "Temperature optimization", tag = "C") +
# theme(panel.grid.major = element_line(size = 0.5, color = "grey"),
# plot.title = element_text(hjust = 0.5),
# axis.line = element_line(size = 0.7, color = "black"),
# text = element_text(size = 16),
# axis.text = element_text(angle=0, vjust=0.5, size=16, face = "bold"))
TempDataPlot <- ggplot(dfTempData, aes(Time, OD, color = Temperature, shape = Temperature)) +
# theme_bw() +
geom_point(size = 2, stroke = 1.5) +
scale_fill_viridis_d(option = "plasma") +
# theme_classic() +
# scale_colour_pander() + c(1, 2, 3, 4, 10, 6, 7, 8, 9)
scale_shape_manual(name = "Temperature (°C)", values=1:nlevels(as.factor(dfTempData$Temperature))) +
scale_color_manual(name = "Temperature (°C)", values=c(1, 2, 3, 4, 10, 6, 7, 8, 9, 11, 12, 14, 16)) +
labs(x = "Time (minutes)", y = expression(paste("Absorbance (OD"["340"], ")", sep = "")),
title = "", tag = "C") +
scale_x_continuous(breaks = seq(0, 60, 10)) +
scale_y_continuous(breaks = seq(0, 0.7, 0.1)) +
theme(panel.grid.major = element_line(size = 0.5, color = "grey"),
plot.title = element_text(hjust = 0.5),
axis.line = element_line(size = 0.7, color = "black"),
text = element_text(size = 24),
axis.text = element_text(angle=0, vjust=0.5, size=18, face = "bold"),
axis.text.x = element_text(angle = 45, hjust = 1),
panel.background = element_rect(fill = "grey85",
size = 0.5, linetype = "solid"),
axis.ticks = element_line(size = 0.5, colour = "black"))
# guides(shape=guide_legend("my title"))
# guides(shape=guide_legend("my title"))
# , shape = "Temperature (°C)"
# ggsave(filename = "Protein/Figures/TempDataPlot.jpg", width = 30, height = 20, units = "cm", dpi = 600)
########## Substrate Concentration ##########
SubstrateConc = read_csv("./Protein/data/SubstrateOptimization.csv")
# SubstrateConc = read_csv("SubstrateOptimization.csv")
dfSubstrateConc <- pivot_longer(SubstrateConc, cols = "No Protein":"1600", names_to = "Concentrations",
values_to = "OD")
dfSubstrateConc$Concentrations <- factor(dfSubstrateConc$Concentrations,
levels = c("No Protein", "No NADH", "25", "50",
"100", "200", "400", "800", "1600"))
SubstrateConcPlot = ggplot(dfSubstrateConc, aes(Time, OD, color = Concentrations, shape = Concentrations)) +
geom_point(size = 2, stroke = 1.5) +
scale_fill_viridis_d(option = "plasma") +
# theme_classic() +
# scale_colour_pander() + c(1, 2, 3, 4, 10, 6, 7, 8, 9)
scale_shape_manual(name = "Substrate (μM)", values=1:nlevels(as.factor(dfSubstrateConc$Concentrations))) +
scale_color_manual(name = "Substrate (μM)", values=c(1, 2, 3, 4, 10, 6, 7, 8, 9)) +
labs(x = "Time (minutes)", y = expression(paste("Absorbance (OD"["340"], ")", sep = "")),
title = "", tag = "D") +
scale_x_continuous(breaks = seq(0, 60, 10)) +
scale_y_continuous(breaks = seq(0, 0.7, 0.1)) +
theme(panel.grid.major = element_line(size = 0.5, color = "grey"),
plot.title = element_text(hjust = 0.5),
axis.line = element_line(size = 0.7, color = "black"),
text = element_text(size = 24),
axis.text = element_text(angle=0, vjust=0.5, size=18, face = "bold"),
axis.text.x = element_text(angle = 45, hjust = 1),
panel.background = element_rect(fill = "grey85",
size = 0.5, linetype = "solid"),
axis.ticks = element_line(size = 0.5, colour = "black"))
# theme_bw() +
# geom_point(size = 1.5) +
# theme_classic() +
# scale_shape_manual(name = "Substrate (μM)", values=1:nlevels(as.factor(dfSubstrateConc$Concentrations))) +
# scale_color_manual(name = "Substrate (μM)", values=1:nlevels(as.factor(dfSubstrateConc$Concentrations))) +
# labs(x = "Time (minutes)", y = expression("OD"[340]),
# title = "Substrate concentration", tag = "D") +
# theme(panel.grid.major = element_line(size = 0.5, color = "grey"),
# plot.title = element_text(hjust = 0.5),
# axis.line = element_line(size = 0.7, color = "black"),
# text = element_text(size = 16),
# axis.text = element_text(angle=0, vjust=0.5, size=16, face = "bold"))
# ggsave(filename = "Protein/Figures/SubstrateConcPlot.jpg", width = 30, height = 20, units = "cm", dpi = 600)
allplots <- grid.arrange(ProteinConcPlot, pHDataPlot, TempDataPlot, SubstrateConcPlot, nrow = 2)
ggsave("Protein/Figures/AllPlots.jpg", allplots, width = 60, height = 40, units = "cm", dpi = 600)
########### SLOPE ###########
df = read_csv("./Protein/data/SlopeNoSignTest.csv")
ggplot(df) +
geom_point(aes(x=S, y = v)) +
theme_bw() +
xlab("Substrate (µM)") +
ylab("Velocity (nmol/min)")
MMformula <-formula(v ~ Vmax * S/(Km+S))
MMmodel <- nls(MMformula, df, start = list(Vmax = 0.01, Km = 800))
summary(MMmodel)
pred <- predictNLS(MMmodel, newdata = data.frame(S = df$S))
pred$summary
# Add the predicted values to the dataframe and plot
df2 <- cbind(df, pred$summary)
ggplot(df2) + geom_point(aes(x = S, y = v), alpha = 0.6) +
geom_line(aes(x=S, y = Prop.Mean.1), color = "red") +
geom_line(aes(x=S, y=`Prop.97.5%`), linetype = 3) +
geom_line(aes(x=S, y=`Prop.2.5%`), linetype = 3) +
xlab("Substrate (µM)") +
ylab("Velocity (µmol/min)")+
theme_bw() +
theme(panel.grid.major = element_line(size = 0.5, color = "grey"),
plot.title = element_text(hjust = 0.5),
axis.line = element_line(size = 0.7, color = "black"),
text = element_text(size = 16),
axis.text = element_text(angle=0, vjust=0.5, size=16, face = "bold"),
panel.background = element_rect(fill = "grey85",
size = 0.5, linetype = "solid"),
axis.ticks = element_line(size = 0.5, colour = "black")) +
geom_text(aes(1250,0.0014, label = paste("Km =", round(coef(MMmodel)[2], 3), "µM")), size = 6) +
geom_text(aes(1250,0.0010, label = paste("Vmax =", round(coef(MMmodel)[1], 3), "µmol/min")), size = 6) +
geom_ribbon(aes(x = S, ymin = `Prop.2.5%`, ymax = `Prop.97.5%`), alpha = 0.2)
ggsave(filename = "Protein/Figures/ProteinSubstrateVmaxKm.jpg", width = 20, height = 20, units = "cm", dpi = 600)
##############################################################
# trying second one
##############################################################
SubstrateConc20min <- SubstrateConc[0:20,]
tidy(lm(SubstrateConc20min$`25` ~ SubstrateConc20min$Time))$estimate[2]
tidy(lm(SubstrateConc20min$`50` ~ SubstrateConc20min$Time))$estimate[2]
tidy(lm(SubstrateConc20min$`100` ~ SubstrateConc20min$Time))$estimate[2]
tidy(lm(SubstrateConc20min$`200` ~ SubstrateConc20min$Time))$estimate[2]
tidy(lm(SubstrateConc20min$`400` ~ SubstrateConc20min$Time))$estimate[2]
tidy(lm(SubstrateConc20min$`800` ~ SubstrateConc20min$Time))$estimate[2]
tidy(lm(SubstrateConc20min$`1600` ~ SubstrateConc20min$Time))$estimate[2]
df = read_csv("./Protein/data/SlopeNoSignTest_2.csv")
# ggplot(df) +
# geom_point(aes(x=S, y = v)) +
# theme_bw() +
# xlab("Substrate (µM)") +
# ylab("Velocity (nmol/min)")
MMformula <-formula(v ~ Vmax * S/(Km+S))
MMmodel <- nls(MMformula, df, start = list(Vmax = 0.01, Km = 800))
summary(MMmodel)
pred <- predictNLS(MMmodel, newdata = data.frame(S = df$S))
pred$summary
# Add the predicted values to the dataframe and plot
df2 <- cbind(df, pred$summary)
ggplot(df2) + geom_point(aes(x = S, y = v), alpha = 0.6) +
geom_line(aes(x=S, y = Prop.Mean.1), color = "red") +
geom_line(aes(x=S, y=`Prop.97.5%`), linetype = 3) +
geom_line(aes(x=S, y=`Prop.2.5%`), linetype = 3) +
xlab("Substrate (µM)") +
ylab("Velocity (µmol/min)")+
theme_bw() +
theme(panel.grid.major = element_line(size = 0.5, color = "grey"),
plot.title = element_text(hjust = 0.5),
axis.line = element_line(size = 0.7, color = "black"),
text = element_text(size = 16),
axis.text = element_text(angle=0, vjust=0.5, size=16, face = "bold"),
panel.background = element_rect(fill = "grey85",
size = 0.5, linetype = "solid"),
axis.ticks = element_line(size = 0.5, colour = "black")) +
geom_text(aes(1250,0.0014, label = paste("Km =", round(coef(MMmodel)[2], 3), "µM")), size = 6) +
geom_text(aes(1250,0.0010, label = paste("Vmax =", round(coef(MMmodel)[1], 3), "µmol/min")), size = 6) +
geom_ribbon(aes(x = S, ymin = `Prop.2.5%`, ymax = `Prop.97.5%`), alpha = 0.2)
ggsave(filename = "Protein/Figures/ProteinSubstrate_2_VmaxKm.jpg", width = 20, height = 20, units = "cm", dpi = 600)
##############################################################
# DONE TILL HERE
##############################################################
# for initial 5 minutes
##############################################################
# Ctrl + Alt + Shift + M to replace them all together
SubstrateConc5min <- SubstrateConc[0:5,]
# Take the slope i.e. other than intercept, paste in excel as velocity against respective concentration
# lm(PecitnConc20min$`No Protein` ~ PecitnConc20min$Time)
tidy(lm(SubstrateConc5min$`No Protein` ~ SubstrateConc5min$Time))$estimate[2]
tidy(lm(SubstrateConc5min$`No NADH` ~ SubstrateConc5min$Time))$estimate[2]
tidy(lm(SubstrateConc5min$`25` ~ SubstrateConc5min$Time))$estimate[2]
tidy(lm(SubstrateConc5min$`50` ~ SubstrateConc5min$Time))$estimate[2]
tidy(lm(SubstrateConc5min$`100` ~ SubstrateConc5min$Time))$estimate[2]
tidy(lm(SubstrateConc5min$`200` ~ SubstrateConc5min$Time))$estimate[2]
tidy(lm(SubstrateConc5min$`400` ~ SubstrateConc5min$Time))$estimate[2]
tidy(lm(SubstrateConc5min$`800` ~ SubstrateConc5min$Time))$estimate[2]
tidy(lm(SubstrateConc5min$`1600` ~ SubstrateConc5min$Time))$estimate[2]
df5min = read_csv("./Protein/data/SlopeNoSignTest5min.csv")
ggplot(df5min) +
geom_point(aes(x=S, y = v)) +
theme_bw() +
xlab("Substrate (µM)") +
ylab("Velocity (nmol/min)")
MMformula <-formula(v ~ Vmax * S/(Km+S))
MMmodel <- nls(MMformula, df5min, start = list(Vmax = 0.01, Km = 800))
summary(MMmodel)
pred <- predictNLS(MMmodel, newdata = data.frame(S = df5min$S))
pred$summary
# Add the predicted values to the dataframe and plot
df2 <- cbind(df5min, pred$summary)
ggplot(df2) + geom_point(aes(x = S, y = v), alpha = 0.6) +
geom_line(aes(x=S, y = Prop.Mean.1), color = "red") +
geom_line(aes(x=S, y=`Prop.97.5%`), linetype = 3) +
geom_line(aes(x=S, y=`Prop.2.5%`), linetype = 3) +
xlab("Substrate (µM)") +
ylab("Velocity (µmol/min)")+
theme_bw() +
theme(panel.grid.major = element_line(size = 0.5, color = "grey"),
plot.title = element_text(hjust = 0.5),
axis.line = element_line(size = 0.7, color = "black"),
text = element_text(size = 16),
axis.text = element_text(angle=0, vjust=0.5, size=16, face = "bold"),
panel.background = element_rect(fill = "grey85",
size = 0.5, linetype = "solid"),
axis.ticks = element_line(size = 0.5, colour = "black")) +
geom_text(aes(1250,0.002, label = paste("Km =", round(coef(MMmodel)[2], 3), "µM")), size = 6) +
geom_text(aes(1250,0.0010, label = paste("Vmax =", round(coef(MMmodel)[1], 3), "µmol/min")), size = 6) +
geom_ribbon(aes(x = S, ymin = `Prop.2.5%`, ymax = `Prop.97.5%`), alpha = 0.2)
ggsave(filename = "Protein/Figures/ProteinSubstrate5minVmaxKm.jpg", width = 20, height = 20, units = "cm", dpi = 600)