The mcaPeaks()
is used to estimate the approximate local minima and
maxima of melting curve data. This can be useful to define a temperature
range for melting curve analysis, quality control of the melting curve or to
define a threshold of peak heights. Melting curves may consist of multiple
significant and insignificant melting peaks. mcaPeaks()
uses
estimated the temperatures and fluorescence values of the local minima and
maxima. The original data remain unchanged and only the approximate local
minima and maxima are returned. mcaPeaks()
takes modified code
proposed earlier by Brian Ripley
(https://stat.ethz.ch/pipermail/rhelp/2002May/021934.html).
1  mcaPeaks(x, y, span = 3)

x 

y 

span 

p.min 
returns a 
p.max 
returns a 
Stefan Roediger
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  # First Example
data(DMP)
# Smooth and MinMax normalize melting curve data with mcaSmoother()
tmp < mcaSmoother(DMP[, 1], DMP[,6], minmax = TRUE, n = 2)
# Extract the first derivative melting curve data
tmp.d < diffQ(tmp, verbose = TRUE)$xy
# Determine the approximate local minima and maxima of a curve
peak.val <mcaPeaks(tmp.d[, 1], tmp.d[, 2])
peak.val
# Plot the first derivative melting curve
# Add a horizontal line and points for the approximate local minima
# and maxima to the plot
plot(tmp.d, type = "l",
main = "Show the approximate local minima and maxima of a curve")
abline(h = 0)
points(peak.val$p.min, col = 1, pch = 19)
points(peak.val$p.max, col = 2, pch = 19)
legend(25, 0.08, c("Minima", "Maxima"), col = c(1,2), pch = c(19,19))
# Second example
# Signifcant peaks can be distinguished by peak hight
plot(tmp.d, type = "l",
main = "Show the approximate local minima and maxima of a curve")
abline(h = 0)
points(peak.val$p.min, col = 1, pch = 19)
points(peak.val$p.max, col = 2, pch = 19)
legend(25, 0.08, c("Minima", "Maxima"), col = c(1,2), pch = c(19,19))
# Test which local maxima peak is above the median + 3 * Median Absolute
# Add a threshold (th) line to the plot
th.max < median(peak.val$p.max[, 2]) + 3 * mad(peak.val$p.max[, 2])
abline(h = th.max, col = 3)
# add the approximate temperatures of the local minima and
# maxima to the plot
T.val < c(peak.val$p.min[, 1], peak.val$p.max[, 1])
text(T.val, rep(0.05, length(T.val)), round(T.val,0))
# Use a temperature range from the plot to calculate the Tm of
# the maximum Trange is used between 37 and 74 degree Celsius
tmp < mcaSmoother(DMP[, 1], DMP[, 6], minmax = TRUE, Trange = c(37,74),
n = 2)
# Tm 48.23, fluoTm 0.137
diffQ(tmp, fct = max, plot = TRUE)

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.