Last data update: 2014.03.03
R: Smooths 'MSnExp' or 'Spectrum' instances
smooth-methods R Documentation
Smooths 'MSnExp' or 'Spectrum' instances
Description
This method smooths individual spectra (Spectrum
instances)
or whole experiments (MSnExp
instances).
Currently, the Savitzky-Golay-Smoothing (method = "SavitzkyGolay"
)
and the Moving-Average-Smoothing (method = "MovingAverage"
) are
available, as implemented in the MALDIquant::smoothIntensity
function.
Additional methods might be added at a later stage.
Methods
signature(x = "MSnExp", method = "character",
halfWindowSize = "integer", verbose = "logical", ...)
Smooths all spectra in MSnExp
. method
could be
"SavitzkyGolay"
or "MovingAverage}. code{halfWindowSize}
controls the window size of the filter. The resulting window size is
code{2 * halfWindowSize + 1}. The best size differs depending on
the selected code{method}. For code{method = "SavitzkyGolay"} it
should be lower than emph{FWHM} of the peaks (full width
at half maximum; please find details in Bromba and Ziegler 1981).
The arguments code{dots} are passed to the internal functions.
Currently the only supported argument is code{polynomialOrder}
(default: 3) for code{method="SavitzkyGolay
to control the
polynomial order of the Savitzky-Golay Filter.
This method displays a progress bar if verbose = TRUE
.
Returns an MSnExp
instance with smoothed spectra.
signature(x = "Spectrum", method = "character",
halfWindowSize = "integer", ...)
Smooths the spectrum (Spectrum
instance). This method is the same
as above but returns a smoothed Spectrum
instead of an
MSnExp
object. It has no verbose
argument. Please read the
details for the above MSnExp
method.
Author(s)
Sebastian Gibb <mail@sebastiangibb.de>
References
A. Savitzky and M. J. Golay. 1964.
Smoothing and differentiation of data by simplified least squares procedures.
Analytical chemistry, 36(8), 1627-1639.
M. U. Bromba and H. Ziegler. 1981.
Application hints for Savitzky-Golay digital smoothing filters.
Analytical Chemistry, 53(11), 1583-1586.
S. Gibb and K. Strimmer. 2012.
MALDIquant: a versatile R package for the analysis of mass spectrometry data.
Bioinformatics 28: 2270-2271.
http://strimmerlab.org/software/maldiquant/
See Also
clean
, pickPeaks
, removePeaks
and
trimMz
for other spectra processing methods.
Examples
sp1 <- new("Spectrum1",
intensity = c(1:6, 5:1),
mz = 1:11)
sp2 <- smooth(sp1, method = "MovingAverage", halfWindowSize = 2)
intensity(sp2)
data(itraqdata)
itraqdata2 <- smooth(itraqdata,
method = "MovingAverage",
halfWindowSize = 2)
processingData(itraqdata2)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(MSnbase)
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
rbind, rownames, sapply, setdiff, sort, table, tapply, union,
unique, unsplit
Loading required package: Biobase
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
Loading required package: mzR
Loading required package: Rcpp
Loading required package: BiocParallel
Loading required package: ProtGenerics
This is MSnbase version 1.20.7
Read '?MSnbase' and references therein for information
about the package and how to get started.
Attaching package: 'MSnbase'
The following object is masked from 'package:stats':
smooth
The following object is masked from 'package:base':
trimws
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/MSnbase/smooth-methods.Rd_%03d_medium.png", width=480, height=480)
> ### Name: smooth-methods
> ### Title: Smooths 'MSnExp' or 'Spectrum' instances
> ### Aliases: smooth-methods smooth
> ### Keywords: methods
>
> ### ** Examples
>
> sp1 <- new("Spectrum1",
+ intensity = c(1:6, 5:1),
+ mz = 1:11)
> sp2 <- smooth(sp1, method = "MovingAverage", halfWindowSize = 2)
> intensity(sp2)
[1] 3.0 3.0 3.0 4.0 4.6 4.8 4.6 4.0 3.0 3.0 3.0
>
> data(itraqdata)
> itraqdata2 <- smooth(itraqdata,
+ method = "MovingAverage",
+ halfWindowSize = 2)
| | | 0% | |= | 2% | |=== | 4% | |==== | 5% | |===== | 7% | |====== | 9% | |======== | 11% | |========= | 13% | |========== | 15% | |=========== | 16% | |============= | 18% | |============== | 20% | |=============== | 22% | |================= | 24% | |================== | 25% | |=================== | 27% | |==================== | 29% | |====================== | 31% | |======================= | 33% | |======================== | 35% | |========================= | 36% | |=========================== | 38% | |============================ | 40% | |============================= | 42% | |=============================== | 44% | |================================ | 45% | |================================= | 47% | |================================== | 49% | |==================================== | 51% | |===================================== | 53% | |====================================== | 55% | |======================================= | 56% | |========================================= | 58% | |========================================== | 60% | |=========================================== | 62% | |============================================= | 64% | |============================================== | 65% | |=============================================== | 67% | |================================================ | 69% | |================================================== | 71% | |=================================================== | 73% | |==================================================== | 75% | |===================================================== | 76% | |======================================================= | 78% | |======================================================== | 80% | |========================================================= | 82% | |=========================================================== | 84% | |============================================================ | 85% | |============================================================= | 87% | |============================================================== | 89% | |================================================================ | 91% | |================================================================= | 93% | |================================================================== | 95% | |=================================================================== | 96% | |===================================================================== | 98% | |======================================================================| 100%
> processingData(itraqdata2)
- - - Processing information - - -
Data loaded: Wed May 11 18:54:39 2011
Spectra smoothed (MovingAverage): Wed Jul 6 01:10:50 2016
MSnbase version: 1.1.22
>
>
>
>
>
> dev.off()
null device
1
>