# Originally created by Carly Huitema & Geoff P Horsman # doi: https://doi.org/10.1101/316588 # Modified by S. Fushinobu (2018.08.17) # Edit the parameters below kic.df <- read.csv("/Users/fushi/Documents/R/InhibitorX.csv") Mtitle <- "Competitive Inhibition" # main title of the plot Inhname <- "Inhibiror X" Inhunit <- "microM" Substname <- "Substrate Y" Substunit <- " (mM)" Vunit <- " (micromol/min/mg)" Kminit <- 4 # initial values for fitting Vmaxinit <- 35 Kicinit <-7 grid <- 5 # grid number for best fit plot lines # determine concentrations of inhibitor used in experiment inhibitor.conc <- unique(kic.df$inhibitor) # create colors for each inhibitor concentration inhib.color <- rainbow(length(inhibitor.conc)) # generate a blank plot and then plot the raw data plot(kic.df$conc,kic.df$rate, pch="", xlim=c(0,max(kic.df$conc)),ylim=c(0,max(kic.df$rate)),main=Mtitle,xlab=paste(Substname,Substunit),ylab=paste("v",Vunit)) for (i in 1:length(inhibitor.conc)) {points(subset(kic.df$conc, kic.df$inhibitor==inhibitor.conc[i]), subset(kic.df$rate, kic.df$inhibitor==inhibitor.conc[i]), col=inhib.color[i], pch=1)} # perform the fitting kic.nls <- nls(rate ~ (Vmax * conc / (Km*(1+inhibitor/Kic) + conc)), data=kic.df, start=list(Km=Kminit, Vmax=Vmaxinit, Kic=Kicinit)) # generate a summary of the fit summary(kic.nls) # confidence intervals of parameters confint(kic.nls) # extract coefficients Km <- unname(coef(kic.nls)["Km"]) Vmax <- unname(coef(kic.nls)["Vmax"]) Kic <- unname(coef(kic.nls)["Kic"]) # use the values directly in the equation to calculate line of best fit gridw <- max(kic.df$conc)*grid fit.data <- expand.grid(x=(0:gridw)/grid, inhib=inhibitor.conc) fit.data$y <- Vmax*fit.data$x/(Km*(1+ fit.data$inhib/Kic)+fit.data$x) # plot lines of best fit for (i in 1:length(inhibitor.conc)) {lines(subset(fit.data$x, fit.data$inhib==inhibitor.conc[i]), subset(fit.data$y, fit.data$inhib==inhibitor.conc[i]), col=inhib.color[i])} # write legends labels <- inhibitor.conc legend("topleft", paste(Inhname,labels,Inhunit), col=inhib.color, pch=1, bg="white")