removePeaks-methods | R Documentation |
This method sets low intensity peaks from individual spectra
(Spectrum
instances) or whole experiments (MSnExp
instances) to 0. The intensity threshold is set with the t
parameter. Default is the "min"
character. The threshold is
then set as the non-0 minimum intensity found in the spectrum. Any
other numeric values is valid. All peaks with maximum intensity
smaller or equal to t
are set to 0.
If the spectrum is in profile mode, ranges of successive non-0 peaks
<= t
are set to 0. If the spectrum is centroided, then
individual peaks <= t
are set to 0. See the example below for
an illustration.
Note that the number of peaks is not changed; the peaks below the
threshold are set to 0 and the object is not cleanded out (see
clean
). An illustrative example is shown below.
signature(object = "MSnExp", t, verbose = "logical" )
Removes low intensity peaks of all spectra in MSnExp
object. t
sets the minimum peak intensity. Default is
"min", i.e the smallest intensity in each spectrum. Other
numeric
values are valid.
Displays a control bar if verbose set to TRUE
(default). Returns a new MSnExp
instance.
signature(object = "Spectrum", t, msLevel. =
"numeric")
Removes low intensity peaks of Spectrum
object. t
sets the minimum peak intensity. Default is
"min", i.e the smallest intensity in each spectrum. Other
numeric
values are valid. msLevel.
defines the level
of the spectrum, and if msLevel(object) != msLevel.
,
cleaning is ignored. Only relevant when called from
OnDiskMSnExp
and is only relevant for developers.
Returns a new Spectrum
instance.
Laurent Gatto
clean
and trimMz
for other spectra
processing methods.
int <- c(2, 0, 0, 0, 1, 5, 1, 0, 0, 1, 3, 1, 0, 0, 1, 4, 2, 1)
sp1 <- new("Spectrum2",
intensity = int,
mz = 1:length(int),
centroided = FALSE)
sp2 <- removePeaks(sp1) ## no peaks are removed here
## as min intensity is 1 and
## no peak has a max int <= 1
sp3 <- removePeaks(sp1, 3)
intensity(sp1)
intensity(sp2)
intensity(sp3)
peaksCount(sp1) == peaksCount(sp2)
peaksCount(sp3) <= peaksCount(sp1)
data(itraqdata)
itraqdata2 <- removePeaks(itraqdata, t = 2.5e5)
table(unlist(intensity(itraqdata)) == 0)
table(unlist(intensity(itraqdata2)) == 0)
processingData(itraqdata2)
## difference between centroided and profile peaks
int <- c(104, 57, 32, 33, 118, 76, 38, 39, 52, 140, 52, 88, 394, 71,
408, 94, 2032)
sp <- new("Spectrum2",
intensity = int,
centroided = FALSE,
mz = seq_len(length(int)))
## unchanged, as ranges of peaks <= 500 considered
intensity(removePeaks(sp, 500))
stopifnot(identical(intensity(sp), intensity(removePeaks(sp, 500))))
centroided(sp) <- TRUE
## different!
intensity(removePeaks(sp, 500))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.