mzFilter-methods {Cardinal} | R Documentation

## Filter the features of an imaging dataset by intensity

### Description

Apply filtering to a mass spectrometry imaging dataset based on the intensities of each peak or mass feature.

### Usage

    ## S4 method for signature 'MSImagingExperiment'
    mzFilter(object, ..., freq.min = NA, rm.zero = TRUE)

    ## S4 method for signature 'MSImagingExperiment'
    peakFilter(object, ..., freq.min = 0.01, rm.zero = TRUE)

    ## S4 method for signature 'MSImageSet'
    peakFilter(object, method = "freq", ...)

    ## Filter based on the frequency of a peak
    peakFilter.freq(x, freq.min=0.01, ...)

### Arguments

`object` | An object of class `MSImageSet`.
`freq.min` | Minimum frequency; peaks that occur in the dataset in lesser proportion than this will be dropped.
`rm.zero` | Remove features with mean intensities of zero.
`...` | Additional arguments passed to the peak filtering method, or conditions evaluating to logical vectors where only those conditions that are TRUE are retained.
`method` | The peak filtering method to use.
`x` | The vector of ion image intensities to filter.

### Details

When applied to a `MSImagingExperiment` object, `mzFilter` and `peakFilter` uses the `summarize()` to generate useful summary statistics about the mass features or detected peaks. These include the ‘min’, ‘max’, ‘mean’, ‘sum’, ‘sd’, and ‘var’ of the intensities for each mass feature or peak. These can be used in logical expressions to filter the features of the dataset.

Note that `peakFilter` is an alias for `mzFilter`, with different default parameters that are more appropriate for peak-picked data rather than profile spectra.

When applied to a `MSImageSet` object, unlike most other processing methods, `peakFilter` operates on the feature space (ion images) of the dataset.

Peak filtering is usually performed using the provided functions, but a user-created function can also be passed to `method`. In this case it should take the following arguments:

- `x`: The vector of ion image intensities to filter.

- `...`: Additional arguments.

A user-created function should return a logical: `TRUE` means keep the peak, and `FALSE` means remove the peak.

Internally, `featureApply` is used to apply the filtering. See its documentation page for more details on additional objects available to the environment installed to the peak filtering function.

### Value

An object of the same class with the filtered peaks.

### Author(s)

Kylie A. Bemis

### See Also

`MSImagingExperiment`, `MSImageSet`, `peakPick`, `peakAlign`, `peakBin`, `reduceDimension`, `featureApply`, `process`

### Examples

    setCardinalBPPARAM(SerialParam())

    set.seed(2)
    data <- simulateImage(preset=1, npeaks=10, dim=c(3,3))
    data <- data[,pData(data)$circle]

    # filter m/z features
    process(mzFilter(data))

    # queue peak picking, alignment, and filtering
    data <- peakPick(data, method="simple", SNR=6)
    data <- peakAlign(data, tolerance=200, units="ppm")
    data <- peakFilter(data, freq.min=0.5)

    # apply peak picking, alignment, and filtering
    data_peaks <- process(data, plot=interactive())

[Package Cardinal version 2.10.0 Index]