Learn R Programming

Cardinal (version 1.4.0)

peakAlign-methods: Peak Align an Imaging Dataset

Description

Apply peak alignment to a mass spectrometry imaging dataset.

Usage

"peakAlign"(object, ref, method = c("diff", "DP"), ..., pixel = pixels(object), plot = FALSE)
"peakAlign"(object, ref, ...)
"peakAlign"(object, ref, ...)
## Absolute difference alignment peakAlign.diff(x, y, diff.max=200, units=c("ppm", "mz"), ...)
## Dynamic programming alignment peakAlign.DP(x, y, gap=0, ...)

Arguments

object
An object of class MSImageSet.
ref
A reference to which to align the peaks.
method
The peak alignment method to use.
pixel
The pixels to align. If less than the extent of the dataset, this will result in a subset of the data being processed.
plot
Plot the mass spectrum for each pixel while it is being processed?
...
Additional arguments passed to the peak alignment method.
x
The vector of m/z values to be aligned.
y
The vector of reference m/z values.
diff.max
Peaks that differ less than this value will be aligned together.
units
Either parts-per-million or the raw m/z values.
gap
The gap penalty for the dynamic programming sequence alignment.

Value

An object of class MSImageSet with the peak aligned spectra.

Details

If a MSImageSet object is used as the reference, then the local maxima in its mean spectrum will be calculated and used as the reference m/z values. If the reference is missing, the method will use the object itself as the reference.

Peak alignment 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 m/z values to be aligned.
  • y: The vector of reference m/z values.
  • ...: Additional arguments.

A user-created function should return a vector of the same length as x and y where NA values indicate no match, and non-missing values give the index of the matched peak in the reference set.

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

See Also

MSImageSet, peakPick, peakFilter, reduceDimension, pixelApply

Examples

Run this code
data <- generateImage(diag(2), as="MSImageSet")
peaks <- peakPick(data, method="simple", plot=interactive())
peaks <- peakAlign(peaks, data, method="diff", plot=interactive())

Run the code above in your browser using DataLab