Learn R Programming

qpcR (version 1.3-7.1)

sliwin: Calculation of qPCR efficiency by the 'window-of-linearity' method

Description

A linear model of Cycles versus log(Fluorescence) is fit within a sliding window of defined size(s) and within a defined border. Regression coefficients are calculated for each window, and at the point of maximum regression (log-linear range) or least variation in slope, parameters such as PCR efficiency and initial template fluorescence are calculated. From version 1.3-5, an approach "not unlike" to Ruijter et al. (2009) has been implemented, in which baseline values can be iteratively subtracted from the data prior to fitting the sliding window. See 'Details' for more information.

Usage

sliwin(object, wsize = 6, basecyc = 1:6, base = 0, border = NULL,
       type = c("rsq", "slope"), plot = TRUE, verbose = TRUE, ...)

Arguments

object
an object of class 'pcrfit'.
wsize
the size(s) of the sliding window(s), default is 6. A sequence such as 4:6 can be used to optimize the window size.
basecyc
if base != 0, which cycles to use for an initial baseline estimation based on the averaged fluorescence values.
base
either 0 for no baseline optimization, or a scalar defining multiples of the standard deviation of all baseline points obtained from basecyc. These are iteratively subtracted from the raw data. See 'Details' and 'Examples'.
border
either NULL (default) or a two-element vector which defines the border from the take-off point to points nearby the upper asymptote (saturation phase). See 'Details'.
type
selection of the window with best baseline + maximum $R^2$ ("rsq") or best baseline + minimal variance in slope + maximum $R^2$ ("slope").
plot
if TRUE, the result is plotted with the logarithmized curve, sliding window, regression line and baseline.
verbose
logical. If TRUE, more information is displayed in the console window.
...
only used internally for passing the parameter matrix.

Value

  • A list with the following components:
  • effthe optimized PCR efficiency found within the sliding window.
  • rsqthe maximum R-squared.
  • initthe initial template fluorescence F0.
  • basethe optimized baseline value.
  • windowthe best window found within the borders.
  • parMata matrix containing the parameters as above for each iteration.

Details

To avoid fits with a high $R^2$ in the baseline region, some border in the data must be defined. In sliwin, this is by default (base = NULL) the region in the curve starting at the take-off cycle ($top$) as calculated from takeoff and ending at the transition region to the upper asymptote (saturation region). The latter is calculated from the first and second derivative maxima: $asympt = cpD1 + (cpD1 - cpD2)$. If the border is to be set by the user, border values such as c(-2, 4) extend these values by $top + border[1]$ and $asympt + border[2]$. The $log_{10}$ transformed raw fluorescence values are regressed against the cycle number $log_{10}(F) = n\beta + \epsilon$ and the efficiency is then calculated by $E = 10^{slope}$. For the baseline optimization, 100 baseline values $Fb_i$ are interpolated in the range of the data: $$F_{min} \le Fb_i \le base \cdot \sigma(F_{basecyc[1]}...F_{basecyc[2]})$$ and subtracted from $F_n$. If type = "rsq", the best window in terms of $R^2$ is selected from all iterations, as defined by wsize and border. If type = "slope", the baseline value delivering the smallest variance in the slope of the upper/lower part of the sliding window and highest $R^2$ is selected. This approach is quite similar to the one in Ruijter et al. (2009) but has to be tweaked in order to obtain the same values as in the 'LinRegPCR' software. Especially the border value has significant influence on the calculation of the best window's efficiency value.

References

Assumption-free analysis of quantitative real-time polymerase chain reaction (PCR) data. Ramakers C, Ruijter JM, Deprez RH, Moorman AF. Neurosci Lett (2003), 339: 62-65. Amplification efficiency: linking baseline and bias in the analysis of quantitative PCR data. Ruijter JM, Ramakers C, Hoogaars WM, Karlen Y, Bakker O, van den Hoff MJ, Moorman AF. Nucleic Acids Res (2009), 37: e45

Examples

Run this code
## sliding window of size 5 between 
## take-off point and upper 
## asymptote, no baseline optimization
m1 <- pcrfit(reps, 1, 2, l4)
sliwin(m1, wsize = 5)

## optimizing with window sizes of 4 to 6,
## between 0/+2 from lower/upper border, 
## and baseline up to 2 standard deviations
sliwin(m1, wsize = 4:6, border = c(0, 2), base = 2)

Run the code above in your browser using DataLab