diffQ
is used to calculate the melting temperature (Tm) but also for
elementary graphical operations (e.g., show the Tm or the derivative). It
does not require smoothed data for the MCA. The parameter rsm
can be
used to double the temperature resolution by calculation of the mean
temperature and mean fluorescence. Note: mcaSmoother has the n
parameter with a similar functionality. First the approximate Tm is
determined as the min()
and/or max()
from the first
derivative. The first numeric derivative (Forward Difference) is estimated
from the values of the function values obtained during an experiment since
the exact function of the melting curve is unknown. The method used in
diffQ
is suitable for independent variables that are equally and
unequally spaced. Alternatives for the numerical differentiation include
Backward Differences, Central Differences or ThreePoint (Forward or
Backward) Difference based on Lagrange Estimation (currently not implemented
in diffQ
). The approximate peak value is the startingpoint for a
function based calculation. The function takes a defined number n (maximum
8) of the left and the right neighbor values and fits a quadratic
polynomial. The quadratic regression of the X (temperature) against the Y
(fluorescence) range gives the coefficients. The optimal quadratic
polynomial is chosen based on the highest adjusted Rsquared value.
diffQ
returns an objects of the class list
. To accessing
components of lists is done as described elsewhere either by name or by
number. diffQ
has a simple plot function. However, for sophisticated
analysis and plots its recommended to use diffQ
as presented in the
examples as part of algorithms.
1 2 3 4 
xy 
is a 
fct 
accepts 
fws 
defines the number (n) of left and right neighbors to use for the calculation of the quadratic polynomial. 
col 
is a graphical parameter used to define the length of the line used in the plot. 
plot 
shows a plot of a single melting curve. To draw multiple curves
in a single plot set 
verbose 
shows additional information (e.g., approximate derivative, ranges used for calculation, approximate Tm) of the calculation. 
warn 
diffQ tries to keep the user as informed as possible about the
quality of the analysis. However, in some scenarios are the warning and
message about analysis not needed or disturbing. 
peak 
shows the peak in the plot (see examples). 
negderiv 
uses the positive first derivative instead of the negative. 
deriv 
shows the first derivative with the color assigned to

derivlimits 
shows the neighbors (fws) used to calculate the Tm as points in the plot (see examples). 
derivlimitsline 
shows the neighbors (fws) used to calculate the Tm as line in the plot (see examples). 
vertiline 
draws a vertical line at the Tms (see examples). 
rsm 
performs a doubling of the temperature resolution by calculation
of the mean temperature and mean fluorescence between successive temperature
steps. Note: 
inder 
Interpolates first derivatives using the fivepoint stencil.
See 
diffQ() 
returns a comprehensive list (if parameter verbose
is TRUE) with results from the first derivative. The list includes a

Tm 
returns the calculated melting temperature ("Tm"). 
fluoTm 
returns the calculated fluorescence at the calculated melting temperature. 
Tm.approx 
returns the approximate melting temperature. 
fluo.x 
returns the approximate fluorescence at the calculated melting temperature. 
xy 
returns the approximate derivative value used for the calculation of the melting peak. 
limits.xQ 
returns a data range of temperature values used to calculate the melting temperature. 
limits.diffQ 
returns a data range of fluorescence values used to calculate the melting temperature. 
adj.r.squared 
returns the adjusted Rsquared from the quadratic
model fitting function (see also 
NRMSE 
returns the normalized rootmeansquarederror (NRMSE) from
the quadratic model fitting function (see also 
fws 
returns the number of points used for the calculation of the melting temperature. 
devsum 
returns measures to show the difference between the approximate and calculated melting temperature. 
temperature 
returns measures to investigate the temperature resolution of the melting curve. Raw fluorescence measurements at irregular temperature resolutions (intervals) can introduce artifacts and thus lead to wrong melting point estimations. 
temperature$T.delta 
returns the difference between two successive temperature steps. 
temperature$mean.T.delta 
returns the mean difference between two temperature steps. 
temperature$sd.T.delta 
returns the standard deviation of the temperature. 
temperature$RSD.T.delta 
returns the relative standard deviation (RSD) of the temperature in percent. 
fit 
returns the summary of the results of the quadratic model fitting function. 
Stefan Roediger
A Highly Versatile Microscope Imaging Technology Platform for the Multiplex RealTime Detection of Biomolecules and Autoimmune Antibodies. S. Roediger, P. Schierack, A. Boehm, J. Nitschke, I. Berger, U. Froemmel, C. Schmidt, M. Ruhland, I. Schimke, D. Roggenbuck, W. Lehmann and C. Schroeder. Advances in Biochemical Bioengineering/Biotechnology. 133:33–74, 2013. http://www.ncbi.nlm.nih.gov/pubmed/22437246
Nucleic acid detection based on the use of microbeads: a review. S. Roediger, C. Liebsch, C. Schmidt, W. Lehmann, U. ReschGenger, U. Schedler, P. Schierack. Microchim Acta 2014:1–18. DOI: 10.1007/s0060401412434
Roediger S, Boehm A, Schimke I. Surface Melting Curve Analysis with R. The R Journal 2013;5:37–53.
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  # First Example
# Plot the first derivative of different samples for single melting curve
# data. Note that the argument "plot" is TRUE.
data(MultiMelt)
par(mfrow = c(1,2))
sapply(2L:14, function(i) {
tmp < mcaSmoother(MultiMelt[, 1], MultiMelt[, i])
diffQ(tmp, plot = TRUE)
}
)
par(mfrow = c(1,1))
# Second example
# Plot the first derivative of different samples from MultiMelt
# in a single plot.
data(MultiMelt)
# First create an empty plot
plot(NA, NA, xlab = "Temperature", ylab ="d(refMFI)/d(T)",
main = "Multiple melting peaks in a single plot", xlim = c(65,85),
ylim = c(0.4,0.01), pch = 19, cex = 1.8)
# Prepossess the selected melting curve data (2,6,12) with mcaSmoother
# and apply them to diffQ. Note that the argument "plot" is FALSE
# while other arguments like derivlimitsline or peak are TRUE.
sapply(c(2,6,12), function(i) {
tmp < mcaSmoother(MultiMelt[, 1], MultiMelt[, i],
bg = c(41,61), bgadj = TRUE)
diffQ(tmp, plot = FALSE, derivlimitsline = TRUE, deriv = TRUE,
peak = TRUE, derivlimits = TRUE, col = i, vertiline = TRUE)
}
)
legend(65, 0.1, colnames(MultiMelt[, c(2,6,12)]), pch = c(15,15,15),
col = c(2,6,12))
# Third example
# First create an empty plot
plot(NA, NA, xlim = c(50,85), ylim = c(0.4,2.5),
xlab = "Temperature",
ylab ="refMFI(T)  refMFI'(T)  refMFI''(T)",
main = "1st and 2nd Derivatives",
pch = 19, cex = 1.8)
# Prepossess the selected melting curve data with mcaSmoother
# and apply them to diffQ and diffQ2. Note that
# the argument "plot" is FALSE while other
# arguments like derivlimitsline or peak are TRUE.
tmp < mcaSmoother(MultiMelt[, 1], MultiMelt[, 2],
bg = c(41,61), bgadj = TRUE)
lines(tmp, col= 1, lwd = 2)
# Note the different use of the argument derivlimits in diffQ and diffQ2
diffQ(tmp, fct = min, derivlimitsline = TRUE, deriv = TRUE,
peak = TRUE, derivlimits = FALSE, col = 2, vertiline = TRUE)
diffQ2(tmp, fct = min, derivlimitsline = TRUE, deriv = TRUE,
peak = TRUE, derivlimits = TRUE, col = 3, vertiline = TRUE)
# Add a legend to the plot
legend(65, 1.5, c("Melting curve",
"1st Derivative",
"2nd Derivative"),
pch = c(19,19,19), col = c(1,2,3))
# Fourth example
# Different curves may potentially have different quality in practice.
# For example, using data from MultiMelt should return a
# valid result and plot.
data(MultiMelt)
diffQ(cbind(MultiMelt[, 1], MultiMelt[, 2]), plot = TRUE)$Tm
# limits_xQ
# 77.88139
# Imagine an experiment that went terribly wrong. You would
# still get an estimate for the Tm. The output from diffQ,
# with an error attached, lets the user know that this Tm
# is potentially meaningless. diffQ() will give several
# warning messages.
set.seed(1)
y = rnorm(55,1.5,.8)
diffQ(cbind(MultiMelt[, 1],y), plot = TRUE)$Tm
# The distribution of the curve data indicates noise.
# The data should be visually inspected with a plot
# (see examples of diffQ). The Tm calculation (fit,
# adj. R squared ~ 0.157, NRMSE ~ 0.279) is not optimal
# presumably due to noisy data. Check raw melting
# curve (see examples of diffQ).
# Calculated Tm
# 56.16755
# Sixth example
# Curves may potentially have a low temperature resolution. The rsm
# parameter can be used to double the temperature resolution.
# Use data from MultiMelt column 15 (MLC2v2).
data(MultiMelt)
tmp < cbind(MultiMelt[, 1], MultiMelt[, 15])
# Use diffQ without and with the rsm parameter and plot
# the results in a single row
par(mfrow = c(1,2))
diffQ(tmp, plot = TRUE)$Tm
text(60, 0.15, "without rsm parameter")
diffQ(tmp, plot = TRUE, rsm = TRUE)$Tm
text(60, 0.15, "with rsm parameter")
par(mfrow = c(1,1))

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.