msPeakMRD {msProcess} | R Documentation |
A multiresolution decomposition (MRD) of the input time is formed using the maximal overlap discrete wavelet transform (MODWT). The sum of the MRD details (D) over the user-specified decomposition level(s) is formed.
If the number of specified decomposition levels is unity, first and second derivative approximations of D are approximated via (approximate) zero phase shifted versions of the MODWT(D) using the Haar and D4 (Daubechies extremal phase 4-tap) wavelet filter, respectively. The index locations of the original series are "marked" where the the first derivative is approximately zero and the second derivative exceeds a user defined threshold, providing an estimate of the local extrema locations in D. Here, we note that a positive convavity threshold is used (as opposed to a negative value) due to a natural negation of the second derivative approximation using the wavelet scheme described above.
If the number of decomposition levels is greater than one,
a simple peak detection scheme (msExtrema
) is used to
return the locations of the local maxima in D.
msPeakMRD(x, y, n.level=floor(log2(length(y))), concavity.threshold=0, snr.thresh=0, process="msPeakMRD")
x |
A numeric vector representing the m/z values of a spectrum. |
y |
A numeric vector representing the intensity values of the spectrum. |
concavity.threshold |
A non-negative concavity threshold. All points in the second derivative approximation
to the calculated detail series that do no exceed this threshold are removed a potential
local extrema candidates. Only used if length(levels) == 1 . Default: 0. |
n.level |
The decomposition level in which the analysis is to be carried out.
limited to floor(log2(length(y))) . Default: floor(log2(length(y))) . |
process |
A character string denoting the name of the
process to register with the (embedded) event history object of the input
after processing the input data.
Default: "msPeakMRD" . |
snr.thresh |
A numeric value representing the signal intensity threshold. Only the local maxima whose signal intensity is above this value will be recorded as peaks. Default: 0. |
A data.frame with 10 columns: peak class location, left bound, right bound and
peak span in both clock tick
("tick.loc"
, "tick.left"
, "tick.right"
, "tick.span"
)
and mass measure
("mass.loc"
, "mass.left"
, "mass.right"
, "mass.span"
),
and peak signal-to-noise ratio and intensity
("snr"
, "intensity"
).
Since noise.local
is NULL
, "snr"
is the same as ("intensity"
).
T. W. Randolph and Y. Yasui, Multiscale Processing of Mass Spectrometry Data, Biometrics, textbf{62}, pp. 589–597, 2006.
D. B. Percival and A. T. Walden, Wavelet Methods for Time Series Analysis, Cambridge University Press, 2000.
wavMODWT
, wavDaubechies
, wavIndex
, msPeak
.
if (!exists("qcset")) data("qcset", package="msProcess") ## extract a subset of a single spectrum mz <- qcset$mz imz <- mz > 3000 & mz < 5000 z <- as.vector(qcset[imz, 1]$intensity) mz <- mz[imz] ## specify the decomposition levels of interest level <- 6 ## calculate the MRD detail D <- wavMRDSum(z, wavelet="haar", levels=level, xform="modwt", keep.smooth=FALSE, keep.details=TRUE, reflect=TRUE) ## locate MODWT MRD detail features via ## wavelet-based first and second derivative ## approximations ipeak1 <- msPeakMRD(mz, D, n.level=level)[["tick.loc"]] ## plot the results plot(D, cex=0.5, ylab=paste("D",level,sep=""), type="b") abline(v=ipeak1, col="blue", lty="dashed")