Description Usage Arguments Details Value Author(s) See Also Examples
Apply peak alignment to a mass spectrometry imaging dataset.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ## S4 method for signature 'MSImagingExperiment,missing'
peakAlign(object, tolerance = NA, 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 imaging dataset. |
ref |
A reference to which to align the peaks. |
tolerance |
The tolerance to be used when aligning detected peaks to the reference. If this is NA, then automatically guess a tolerance from the data. |
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. |
When applied to a MSImagingExperiment
object with no other reference, peakAlign
uses summarize()
to calculate the mean spectrum, and then uses the local maxima of the mean spectrum as the reference. Alternatively, a vector of m/z values or a column name in the featureData that should be used as the reference may be provided. Finally, if the featureData has an numeric vector element named “reference peaks” among its metadata()
, this vector is used as the reference.
When applied to a MSImageSet
object, 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
MSImagingExperiment
,
MSImageSet
,
peakPick
,
peakFilter
,
peakBin
,
reduceDimension
,
pixelApply
,
process
1 2 3 4 5 6 7 8 9 10 11 12 | setCardinalBPPARAM(SerialParam())
set.seed(2)
data <- simulateImage(preset=1, npeaks=10, dim=c(3,3))
data <- data[,pData(data)$circle]
# queue peak picking and alignment
data <- peakPick(data, method="simple", SNR=6)
data <- peakAlign(data, tolerance=200, units="ppm")
# apply peak picking and alignment
data_peaks <- process(data, plot=interactive())
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.