Skip to content

Instantly share code, notes, and snippets.

@friveroll
Last active October 3, 2021 19:03
Show Gist options
  • Save friveroll/2779025 to your computer and use it in GitHub Desktop.
Save friveroll/2779025 to your computer and use it in GitHub Desktop.
Simple enzyme kinetics
#Data from Problem 1 Chapter 4 from
#Biochemical Calculations by Irwin H Segel
#Set the initial values and get a data.frame
S <- c(2.5e-06, 3.33e-06, 4.0e-06, 5.0e-06, 1.0e-05, 2.0e-05, 4.0e-05, 1.0e-04, 2.0e-03, 1.0e-02)
v <- c(24, 30, 34, 40, 60, 80, 96, 109, 119, 120)
data.frame(S, v) -> datos.cinetica
#Plot the raw data
plot(datos.cinetica, type="l", main="V Vs. S", xmain="S", ymain="v")
#Get a vector from reciprocal values to apply Lineweaver-Burk model
r.S <- 1/S
r.v <- 1/v
#Plot the reciprocal from raw data
plot(r.S, r.v, main="Lineweaver-Burk", xlab="1/[S]", ylab="1/v", pch=20, col="blue")
#Use linear regression to get the Lineweaver-Burk model and add a red line to the graph
lm(r.v ~ r.S) -> lineweaver.reg
abline(lineweaver.reg, col="red")
#In order to get Vmax we need to look for the values at the regression model and calculate the reciprocal
interseccion.y <- coef(lineweaver.reg)[1]
r.Vmax <- interseccion.y
Vmax <- 1/r.Vmax
#Get the slope from the regression model
pendiente <- coef(lineweaver.reg)[2]
#Get the X intersection value
interseccion.x <- -(interseccion.y/pendiente)
#Get the Km value, from the reciprocal of X intersection value
r.km <- interseccion.x
km <- -1/r.km
#Get Vmax and Km as an R vector from Lineweaver-Burk model
Lineweaver.Burk <- c(Vmax=as.numeric(Vmax), Km=as.numeric(km))
#Now we obtain the Vmax and Km from Michaelis Menten equation
Mfit <- nls(v~(Vmax*S)/(Km+S),
datos.cinetica,
start=list(Vmax=1, Km=0))
#Get a vector with the values Vmax and Km from Michaelis Menten non linear regression
Michaelis.Menten <- c(Vmax=as.numeric(coef(Mfit)[1]), Km=as.numeric(coef(Mfit)[2]))
#Plot the predicted V values from Michaelis Menten non linear regression model
plot(S, predict(Mfit), type="l", main="V Vs. S", xlab="S", ylab="v")
#And finally get a data.frame for value comparission
rbind(Lineweaver.Burk, Michaelis.Menten)
@pamelacruzbr
Copy link

Well done !! Thanks a lot for this script, it really helped me !

I'm beginner in R language and I would like to learn more. Would you have other scripts regarding enzymology in R ?
I'm trying to plot and run statistics in enzyme characterization (Temperature and pH).

Thanks in advance,
Pamela

@nickp60
Copy link

nickp60 commented Jun 29, 2018

Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment