mzAlign-methods {Cardinal} | R Documentation |
Apply spectral alignment to a mass spectrometry imaging dataset.
## S4 method for signature 'MSImagingExperiment,numeric' mzAlign(object, ref, tolerance = NA, units = c("ppm", "mz"), quantile = 0.2, span = 0.75, ...) ## S4 method for signature 'MSImagingExperiment,missing' mzAlign(object, tolerance = NA, units = c("ppm", "mz"), quantile = 0.2, span = 0.75, ...)
object |
An imaging dataset. |
ref |
A reference spectrum to use for alignment. |
tolerance |
The tolerance to be used when matching the peaks in the unaligned spectra to the reference spectrum. If this is NA, then automatically guess a tolerance from the data. |
units |
The units to use for the |
quantile |
The top quantile of reference points (peaks detected via local maxima) to use from the reference spectrum. |
span |
The smoothing parameter for the local polynomial regression used to determine the warping function. |
... |
Ignored. |
Mass binning is performed by first selecting reference points in the reference spectrum by detecting local maxima. Some number of these reference points with the highest intensities (determined by quantile
) are then used for alignment. The nearest local maxima to the reference points are detected in each unaligned spectrum (within tolerance
), and then the unaligned spectra are warped to maximize correlation with the reference spectrum.
Internally, pixelApply
is used to perform the alignment. See its documentation page for more details.
An object of the same class with the aligned spectra.
Kylie A. Bemis
MSImagingExperiment
,
mzBin
,
peakAlign
,
pixelApply
,
process
setCardinalBPPARAM(SerialParam()) set.seed(2) data <- simulateImage(preset=1, npeaks=10, dim=c(3,3), sdmz=500) data <- data[,pData(data)$circle] # queue spectral alignment data <- mzAlign(data, tolerance=1, units="mz") # apply spectral alignment data_aligned <- process(data, plot=interactive())