enzKinet2’s functions take data as a data frame with one row per measurement and one column per model variable. This page shows how to get your own measurements into that shape.
What enzKinet2 fits
The enzyme models describe initial rates: the rate of reaction at the start, before substrate is used up or product builds up. If you measured progress curves (product against time), work out the initial rate of each reaction first, for example from the slope of the early, straight part of the curve, then fit the rates. The binding models describe the fraction of a partner that is bound at equilibrium.
The columns each model needs
Each model’s variables are named by short column names. Your data frame needs exactly these names; other columns are ignored:
| Code | Model | Independent variable | Dependent variable | Extra variable |
|---|---|---|---|---|
| MM | Michaelis-Menten | A | V | |
| MMSI | Michaelis-Menten with Substrate Inhibition | A | V | |
| OGMM | Original Michaelis-Menten | A | V | |
| ALTMM | Alternative Michaelis-Menten | A | V | |
| CI | Competitive Inhibition | A | V | I |
| UCI | Uncompetitive Inhibition | A | V | I |
| NCI | Non-competitive Inhibition | A | V | I |
| MI | Mixed Inhibition | A | V | I |
| TC | Ternary Complex | A | V | B |
| HILL | Hill | A | V | |
| PP | Ping-Pong | A | V | B |
| BK | Binding Kinetics | P | FB | |
| BKH | Hill Binding Kinetics | P | FB | |
| QBK | Quadratic Binding Kinetics | P | FB | R |
-
A: substrate concentration (substrate A for the two-substrate models).V: the rate. -
I: inhibitor concentration.B: concentration of the second substrate. -
P: concentration of the binding partner in excess.FB: fraction bound, from 0 to 1.R: total concentration of the limiting partner, which must be greater than 0.
MODEL_VARIABLES[["CI"]] gives the same list in code.
Reading a CSV file
enzKinet2 comes with an example file of Michaelis-Menten rates. Like most real data, its columns have their own names:
path <- system.file("extdata", "michaelis-menten.csv", package = "enzKinet2")
raw <- read.csv(path)
head(raw)
#> substrate_mM rate_uM_min
#> 1 0.10 1.37
#> 2 0.10 1.27
#> 3 0.10 1.16
#> 4 0.25 2.70
#> 5 0.25 2.87
#> 6 0.25 3.05Make a data frame with the model’s column names. Here the substrate
concentration becomes A and the rate becomes
V:
data <- data.frame(A = raw$substrate_mM, V = raw$rate_uM_min)Now it works with every function:
fit <- fit_model("MM", data, start.params = list(Km = 1, Vmax = 10), get.conf.int = TRUE)
fit$fitted.params
#> $Km
#> [1] 0.7641861
#>
#> $Vmax
#> [1] 11.58654
#>
#> $Km.lb
#> [1] 0.6839159
#>
#> $Km.ub
#> [1] 0.8534718
#>
#> $Vmax.lb
#> [1] 11.21668
#>
#> $Vmax.ub
#> [1] 11.97201
make_plot("MM", data.df = data, curve.df = make_curve("MM", fit$fitted.params, x.min = 0, x.max = 8),
x.units = "mM", y.units = "µM/min")
For your own file, give read.csv() its path instead:
raw <- read.csv("my-rates.csv")Michaelis-Menten from a CSV takes this example further.
Reading an Excel file
Use the readxl package, which you may need to install first:
# install.packages("readxl")
raw <- readxl::read_excel("my-rates.xlsx", sheet = 1)
data <- data.frame(A = raw$substrate_mM, V = raw$rate_uM_min)read_excel() returns a tibble. Building a plain data
frame from its columns, as above, avoids any surprises.
Units
enzKinet2 doesn’t know about units: parameters come out in the units
of your data. With substrate in mM and rates in µM/min, Km is in mM and
Vmax in µM/min. An inhibition constant is in the units of the inhibitor
concentration, and a dissociation constant in the units of
P.
Starting values must be in the same units too. Data in molar units,
with concentrations like 0.0000005 M, fits fine from starting values on
that scale, but starting values like 1 would fail. Units that keep the
numbers moderate (0.5 µM rather than 0.0000005 M) make starting values
easier to choose and results easier to read. x.units and
y.units in the plotting functions only label the axes; they
don’t convert anything.
Replicates
Keep replicates as separate rows with the same concentration, rather than averaging them, so the fit sees every measurement:
head(data[order(data$A), ], 6)
#> A V
#> 1 0.10 1.37
#> 2 0.10 1.27
#> 3 0.10 1.16
#> 4 0.25 2.70
#> 5 0.25 2.87
#> 6 0.25 3.05The example file has three replicates at each concentration.
Several inhibitor or substrate levels
For a model with an extra variable, put each measurement’s level of it in its own column. The second example file has rates at four inhibitor concentrations:
raw <- read.csv(system.file("extdata", "inhibition.csv", package = "enzKinet2"))
head(raw)
#> substrate_mM inhibitor_uM rate_uM_min
#> 1 0.2 0 2.38
#> 2 0.2 0 2.54
#> 3 0.5 0 4.36
#> 4 0.5 0 4.75
#> 5 1.0 0 7.06
#> 6 1.0 0 6.56
inhibition <- data.frame(A = raw$substrate_mM, I = raw$inhibitor_uM, V = raw$rate_uM_min)
table(inhibition$I)
#>
#> 0 10 25 50
#> 12 12 12 12Include the measurements without inhibitor (I = 0): they
pin down Km and Vmax. You need at least two different values of the
extra variable, and in practice several. With the inhibitor in µM, the
inhibition constants come out in µM:
fit <- fit_model("MI", inhibition, start.params = list(Km = 1, Vmax = 10, Kic = 10, Kiu = 10),
get.conf.int = TRUE)
round(unlist(fit$fitted.params), 2)
#> Km Vmax Kic Kiu Km.lb Km.ub Vmax.lb Vmax.ub Kic.lb Kic.ub
#> 0.80 12.21 19.71 53.79 0.73 0.88 11.89 12.54 16.33 24.16
#> Kiu.lb Kiu.ub
#> 47.17 62.11
make_plot("MI", data.df = inhibition,
curve.df = make_curve("MI", fit$fitted.params, x.min = 0, x.max = 8,
z.values = unique(inhibition$I)),
x.units = "mM", y.units = "µM/min", legend.label = "Inhibitor (µM)")
Pass the same levels to make_curve() as
z.values, so there’s one curve per level. Telling inhibition types apart
compares the inhibition models on this data.
Missing values
fit_model() refuses data with NA in the
model’s columns. Remove those rows first:
with_gap <- data
with_gap$V[3] <- NA
complete <- with_gap[complete.cases(with_gap[, c("A", "V")]), ]
nrow(with_gap)
#> [1] 21
nrow(complete)
#> [1] 20NA in other columns, such as notes, doesn’t matter.
What fit_model() checks
Before fitting, fit_model() checks that:
- every column the model needs is present and numeric, with no
NA; - there are more data points than free parameters (at least one more);
- a model with an extra variable has at least two different values of it;
- for
"QBK", everyRvalue is greater than 0.
It doesn’t check that concentrations and rates are 0 or more, so check your data for typing errors yourself. Troubleshooting explains each error message.
Data from EKA2
EKA2’s “Download Data” button saves the data you’re working with as a
CSV file with the model’s column names (A, V
and so on), so it reads straight into R with read.csv().
See Reproducing an EKA2 analysis in
R.
