msSmoothMRD: Baseline Estimation via Partial Summation of an MRD

Description Usage Arguments Value References See Also Examples

Description

Forms a multiresolution decomposition (MRD) by taking a specified discrete wavelet transform of the input spectrum and subsequently inverting each level of the transform back to the "time" domain. The resulting components of the MRD form an octave-band decomposition of the original spectrum, and can be summed together to reconstruct the original spectrum. In many real-world observations, the trend of the data is caught up in the last decomposition level's so-called smooth, which corresponds to residual low frequency content. This function allows the user to approximate the baseline trend in a mass spectrum by calculating the MRD smooth. Additionally, the user has the option to include relatively higher frequency content in the approximation by including various MRD details (see the DETAILS section for a definition of MRD details and MRD smooth). As this function primarily calls the wavMRDSum function with appropriate arguments, see the corresponding help documentation for more details.

Usage

1
2
3
4
msSmoothMRD(x, wavelet="s8", levels=1,
    xform="modwt", reflect=TRUE,
    keep.smooth=TRUE, keep.details=FALSE,
    process="msSmoothMRD")

Arguments

x

A vector containing a uniformly-sampled real-valued time series.

keep.details

A logical value. If TRUE, the details corresponding to the specified levels are included in the partial summation over the MRD components. The user also has the choice to include the smooth in the summation via the keep.smooth option, but one of keep.details and keep.smooth must be TRUE. Default: FALSE.

keep.smooth

A logical value. If TRUE, the smooth at the last decomposition level is added to the partial summation over specified details. The smooth typically contains low-frequency trends present in a spectrum. The user also has the choice to include the details in the summation via the keep.details option, but one of keep.details and keep.smooth must be TRUE. Default: TRUE.

levels

An integer vector of integers denoting the MRD detail(s) to sum over in forming a denoised approximation to the orginal spectrum (the summation is performed across scale and nto across time). All values must be positive integers, and cannot exceed floor(logb(length(x),2)) if reflect=FALSE and, if reflect=TRUE, cannot exceed floor(logb((length(x)-1)/(L-1) + 1, b=2)) where L is the length of the wavelet filter. Use the keep.smooth option to also include the last level's smooth in the summation. Default: 1.

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. This process is not updated if it already exists in the event history. Default: "msSmoothMRD".

reflect

A logical value. If TRUE, the last Lj = (2^n.level - 1)(L - 1) + 1 coefficients of the series are reflected (reversed and appended to the end of the series) in order to attenuate the adverse effect of circular filter operations on wavelet transform coefficients for series whose endpoint levels are (highly) mismatched. The variable Lj represents the effective filter length at decomposition level n.level, where L is the length of the wavelet (or scaling) filter. A similar operation is performed at the beginning of the series. After synthesis and (partial) summation of the resulting details and smooth, the middle N points of the result are returned, where N is the length of the original time series. Default: TRUE.

wavelet

A character string denoting the filter type. See wavDaubechies for details. Default: "s8".

xform

A character string denoting the wavelet transform type. Choices are "dwt" and "modwt" for the discrete wavelet transform (DWT) and maximal overlap DWT (MODWT), respectively. The DWT is a decimated transform where (at each level) the number of transform coefficients is halved. Given N is the length of the original time series, the total number of DWT transform coefficients is N. The MODWT is a non-decimated transform where the number of coefficients at each level is N and the total number of transform coefficients is N*n.level. Unlike the DWT, the MODWT is shift-invariant and is seen as a weighted average of all possible non-redundant shifts of the DWT. See the references for details. Default: "modwt".

Value

A vector containing the baseline trend of the input spectrum.

References

D. B. Percival and A. T. Walden, Wavelet Methods for Time Series Analysis, Cambridge University Press, 2000.

T.W. Randolph and Y. Yasui, Multiscale Processing of Mass Spectrometry Data, Biometrics, 62:589–97, 2006.

See Also

wavMRDSum, msDetrend, wavDaubechies, wavDWT, wavMODWT, wavMRD, eventHistory.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
if (!exists("qcset")) data("qcset", package="msProcess")

## obtain a subset of a mass spectrum and add some
## noise
x <- qcset$intensity[5000:10000,1]
sd.noise <- 2
set.seed(100)
xnoise <- x + rnorm(length(x), sd=sd.noise)
mz <- as.matrix(as.numeric(names(x)))

## calculate the smooth at decomposition level 9
## and use that as an approximation of the
## spectrum baseline
z <- msSmoothMRD(xnoise, levels=9)

## plot the results
plot(range(mz), range(xnoise), type="n",
    xlab="m/z", ylab="Spectrum and Baseline Estimation")
lines(mz, xnoise, type="l", lty=2, col=1)
lines(mz, z, lty=1, lwd=3, col=2)

zeehio/msProcess documentation built on May 4, 2019, 10:15 p.m.