Description Usage Arguments Value Note See Also Examples
Denoise spectra with various functions.
1 2 |
x |
An object of class |
... |
Additional arguments to |
FUN |
Either an object of class character: A character string denoting the
method to use in denoising the data.
Supported choices are function: A user-defined function with an argument list
of the form In either case, the additional arguments |
attach.noise |
A logical indicating if the noise removed
should be attached or not. Default: |
event |
A character string denoting the name of the
event to register with the (embedded) event history object of the input
after processing the input data. Default: |
An object of class msSet
,
optionally, with the estimated noise attached as element "noise"
.
If FUN="mrd"
, an mrd
object containing meta information regarding
the multiresolution decomposition is attached to the msSet
output object for subsequent
use by other MRD-based function calls such as msPeak(x, FUN="mrd", ...
.
msDenoiseSmooth
, msDenoiseWavelet
, msDenoiseMRD
, matchObject
.
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 | if (!exists("qcset")) data("qcset", package="msProcess")
## denoise a spectrum portion via waveshrink and a
## smoothing function
mz <- (qcset$mz > 3000 & qcset$mz < 5000)
data <- qcset[mz, 1, drop=FALSE]
## add a little Gaussian noise for illustration
noise <- rnorm(length(data$intensity), sd=stdev(data$intensity)/3)
xnoise <- data
xnoise$intensity <- data$intensity +
matrix(noise, ncol=1)
## denoise using the supported routines
z1 <- msDenoise(xnoise, FUN="wavelet")
z2 <- msDenoise(xnoise, FUN="smooth")
z3 <- msDenoise(xnoise, FUN="mrd", levels=4:6)
## create a user-defined (albeit naive) denoising
## function
my.fun <- function(x, wavelet="d4"){
filt <- wavDaubechies(wavelet=wavelet, norm=FALSE)$scaling
return(filter(x, filt))
}
z4 <- msDenoise(xnoise, FUN=my.fun, wavelet="s12")
## create a stackplot of the results
z <- list(original=data$intensity[,1],
noisy=xnoise$intensity[,1],
waveshrink=z1$intensity[,1],
smooth=z2$intensity[,1],
mrd=z3$intensity[,1],
"my function"=z4$intensity[,1])
wavStackPlot(z, col=seq(along=z), same.scale=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.