| MergeNeighboringPeaksParam {xcms} | R Documentation |
Peak detection sometimes fails to identify a chromatographic peak correctly, especially for broad peaks and if the peak shape is irregular (mostly for HILIC data). In such cases several smaller peaks are reported. This function tries to combine such peaks again if they are overlappoing on m/z dimension and considering their distance in retention time dimension and the measured intensity between them.
Chromatographic peaks are first expanded in m/z and retention time dimension
by expandMz and expandRt and subsequently grouped into candidates for
merging if they are (after expansion) overlapping in both m/z and rt (within
the same sample). Peaks are merged if the intensity at the position at half
way between them (i.e. at half the distance between "rtmax" of the first
and "rtmin" of the second peak) is larger than a certain proportion
(minProp) of the smaller maximal intensity ("maxo") of both peaks.
The joined peaks get the "mz", "rt", "sn" and "maxo" values from
the peak with the largest signal ("maxo") as well as its row in the
metadata data frame of the peak (chromPeakData). The "rtmin", "rtmax"
of the merged peaks are updated and "into" is recalculated based on all
the signal between "rtmin" and "rtmax" of the new merged peak.
MergeNeighboringPeaksParam(expandRt = 2, expandMz = 0, ppm = 10, minProp = 0.75) ## S4 method for signature 'XCMSnExp,MergeNeighboringPeaksParam' refineChromPeaks(object, param = MergeNeighboringPeaksParam(), msLevel = 1L, BPPARAM = bpparam())
expandRt |
|
expandMz |
|
ppm |
|
minProp |
|
object |
XCMSnExp object with identified chromatographic peaks. |
param |
|
msLevel |
|
BPPARAM |
parameter object to set up parallel processing. Uses the
default parallel processing setup returned by |
XCMSnExp object with chromatographic peaks matching the defined
conditions being merged.
Note that each peak gets expanded by expandMz and expandRt, thus
peaks differing by 2 * expandMz (or expandRt) will be identified as
overlapping. As an example: m/z max of one peak is 12.2, m/z min of
another one is 12.4, if expandMz = 0.1 the m/z max of the first peak
will be 12.3 and the m/z min of the second one 12.3, thus both are
considered overlapping.
refineChromPeaks methods will always remove feature definitions, because
a call to this method can change or remove identified chromatographic peaks,
which may be part of features.
Johannes Rainer
Other chromatographic peak refinement methods: CleanPeaksParam
xd <- readMSData(system.file('cdf/KO/ko15.CDF', package = "faahKO"),
mode = "onDisk")
xd <- findChromPeaks(xd, param = CentWaveParam(noise = 5000))
## Example of a split peak that will be merged
mzr <- 305.1 + c(-0.01, 0.01)
chr <- chromatogram(xd, mz = mzr)
plot(chr)
## Combine the peaks
res <- refineChromPeaks(xd, param = MergeNeighboringPeaksParam(expandRt = 4))
chr_res <- chromatogram(res, mz = mzr)
plot(chr_res)
## Example of a peak that was not merged, because the signal between them
## is lower than the cut-off minProp
mzr <- 496.2 + c(-0.01, 0.01)
chr <- chromatogram(xd, mz = mzr)
plot(chr)
chr_res <- chromatogram(res, mz = mzr)
plot(chr_res)