peakRegionMask: Peak Region Mask

.peakRegionMaskR Documentation

Peak Region Mask

Description

This function finds the mz region spanning by a peak. It creates an 0/1 matrix used for multiplications in other functions.

Usage

.peakRegionMask(x, p, k = 30L)

Arguments

x

numeric, e.g. intensity values.

p

integer, indices of identified peaks/local maxima.

k

integer(1): maximum number of values left and right of the peak that should be looked for valleys.

Value

A matrix with a column for each peak in p and 2 * k + 1 rows where the middle row k + 1 is the peak centroid. If the values is 1 the index belongs to the peak region.

Author(s)

Sebastian Gibb

See Also

Other extreme value functions: localMaxima(), refineCentroids(), valleys()

Examples

ints <- c(5, 8, 12, 7, 4, 9, 15, 16, 11, 8, 3, 2, 3, 2, 9, 12, 14, 13, 8, 3)
mzs <- seq_along(ints)
peaks <- which(localMaxima(ints, hws = 3L))

m <- MsCoreUtils:::.peakRegionMask(ints, peaks, k = 5L)

rformassspectrometry/MsCoreUtils documentation built on Oct. 24, 2024, 1:52 p.m.