| msPeakInfo {msProcess} | R Documentation |
Provides a common interface for packing detected mass spectrometry peaks into an appropriate output object.
msPeakInfo(x, y, index.min, index.max, noise.local = NULL, snr.thresh = 2)
x |
A numeric vector representing the m/z values of a spectrum. |
y |
A numeric vector representing the intensity values of the spectrum. |
index.max |
A logical vector the size of the original mass spectrum. If the
kth element is TRUE, it indicates that the corresonding kth element of the
original mass spectrum is a local maxima. |
index.min |
A logical vector the size of the original mass spectrum. If the
kth element is TRUE, it indicates that the corresonding kth element of the
original mass spectrum is a local minima. It is assumed that for each peak (identified
as a TRUE element in index.max) there exists two minima which encompass
the peak in time. Hence, it is expected that length(which(index.min)) will be one
greater than length(which(index.max)). |
noise.local |
A numeric vector representing the estimated instantaneous noise level,
i.e., one noise element for each m/z value. This argument is used to form signal-to-noise
ratio (SNR) estimates that are subsequently compared to the snr.thresh argument in the
pruning process. Default: NULL (no SNR pruning is performed). |
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: 2. |
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").
msPeak, msPeakSimple, msPeakMRD, msPeakCWT.
if (!exists("qcset")) data("qcset", package="msProcess")
## create faux MS peak data
z <- qcset[seq(500), 1]
x <- z$mz
y <- z$intensity
noise <- as.vector(wavCWT(y, n.scale=1))
index.min <- peaks(-y, span=31)
index.max <- peaks(y, span=31)
## pack data using the constructor
msPeakInfo(x, y, index.min, index.max, noise.local=noise, snr.thresh=1.3)