peakAlign-methods {Cardinal} | R Documentation |
Apply peak alignment to a mass spectrometry imaging dataset.
## S4 method for signature 'MSImagingExperiment,missing' peakAlign(object, tolerance = 200, units = c("ppm", "mz"), ...) ## S4 method for signature 'MSImagingExperiment,character' peakAlign(object, ref, ...) ## S4 method for signature 'MSImagingExperiment,numeric' peakAlign(object, ref, ...) ## S4 method for signature 'MSImageSet,numeric' peakAlign(object, ref, method = c("diff", "DP"), ..., pixel = pixels(object), plot = FALSE) ## S4 method for signature 'MSImageSet,MSImageSet' peakAlign(object, ref, ...) ## S4 method for signature 'MSImageSet,missing' 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, ...)
object |
An object of class |
ref |
A reference to which to align the peaks. |
tolerance |
The tolerance to be used when aligning detected peaks to the reference. |
units |
The units to use for the |
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. |
gap |
The gap penalty for the dynamic programming sequence alignment. |
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. The method looks for a “mean” column in the object's featureData
, and if it does not exist, then the mean spectrum will be calculated using featureApply(ref, mean)
. 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.
An object of class MSImageSet
with the peak aligned spectra.
Kylie A. Bemis
MSImageSet
,
MSImagingExperiment
,
peakPick
,
peakFilter
,
peakBin
,
reduceDimension
,
pixelApply
,
process
data <- generateImage(diag(2), as="MSImageSet") peaks <- peakPick(data, method="simple", plot=interactive()) peaks <- peakAlign(peaks, data, method="diff", plot=interactive())