MSnbase (version 1.20.7)

removePeaks-methods: Removes low intensity peaks

Description

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.

Arguments

Methods

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)
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. Returns a new Spectrum instance.

See Also

clean and trimMz for other spectra processing methods.

Examples

Run this code
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))
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))


centroided(sp) <- TRUE
## different!
intensity(removePeaks(sp, 500))

Run the code above in your browser using DataLab