peakBin-methods {Cardinal} | R Documentation

## Peak bin an imaging dataset

### Description

Apply peak binning to a mass spectrometry imaging dataset.

### Usage

    ## S4 method for signature 'MSImagingExperiment,numeric'
    peakBin(object, ref, type=c("area", "height"),
            tolerance = NA, units = c("ppm", "mz"), ...)

    ## S4 method for signature 'MSImagingExperiment,missing'
    peakBin(object, type=c("area", "height"),
            tolerance = NA, units = c("ppm", "mz"), ...)

### Arguments

`object` | An imaging dataset.
`ref` | A reference to which the peaks are binned.
`type` | Should the summarized intensity of the peak by the maximum height of the peak or the area under the curve?
`tolerance` | The tolerance to be used when matching the m/z features in the dataset to the reference. If this is NA, then automatically guess a resolution from the data.
`units` | The units to use for the `tolerance`.
`...` | Ignored.

### Details

Peak binning is performed by first matching the m/z-values in the dataset to those in the reference, and then finding the boundaries of the peak by detecting the nearest local minima. Then either the maximum height or the area under the curve of the peak are returned.

Internally, `pixelApply` is used to apply the binning. See its documentation page for more details.

### Value

An object of the same class with the binned peaks.

### Author(s)

Kylie A. Bemis

### See Also

`MSImagingExperiment`, `peakPick`, `peakAlign`, `peakFilter`, `reduceDimension`, `pixelApply`, `process`

### Examples

    setCardinalBPPARAM(SerialParam())

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

    # queue peak binning
    data <- peakBin(data, ref=ref, type="height")

    # apply peak binning
    data_peaks <- process(data, plot=interactive())

[Package Cardinal version 2.10.0 Index]