Two methods for peak detection in baseline corrected spectral data. Methods include signal-to-noise ratio and slopes of peaks.

peakDet(
  dat,
  mass_dat,
  intensity_dat,
  method = NULL,
  n = NULL,
  SNR_thresh = NULL
)

Arguments

dat

The name of the spectral data frame, containing m/z data in the first column and spectral intensity data in subsequent columns.

mass_dat

Character string. The name of the column in dat containing the m/z data for the spectrum.

intensity_dat

Character string. The name of the column in dat containing the intensity data for the spectrum.

method

Character string. The method of peak detection. Either "snr" for signal-to-noise ratio, or "slopes" for slopes of peaks.

n

Single numeric value. For both method = "snr" and method = "slopes", the window size used to calculate noise. Noise is defined as the median of the absolute deviation (MAD) of points within a window [1].

SNR_thresh

Single numeric value. When method = "snr", the signal-to-noise ratio (SNR) threshold for discarding peaks. If the SNR of a peak falls below this threshold, it will be discarded.

Value

Returns a new data frame containing only the peaks which have passed the detection criteria.

Methods

snr

Each spectrum is divided into segments of size n. Noise is calculated as the median absolute deviation of points within each segment [1]. If the intensity of a peak divided by the noise in that segment is less than the indicated SNR_thresh, the peak is discarded.

slopes

Uses the shapes of peaks to remove false peak candidates [1]. First, the left and right endpoints of each peak are identified on the baseline. Next, the slopes of each endpoint are evaluated. If the either the left or right slope are less than a defined threshold, the peak candidate is discarded [1]. The threshold is defined as half of the local noise level, or half of the median absolute deviation in a window of size n.

References

https://github.com/wesleyburr/subMaldi (1) Yang, C., He, Z. & Yu, W. Comparison of public peak detection algorithms for MALDI mass spectrometry data analysis. BMC Bioinformatics 10, 4 (2009). https://doi.org/10.1186/1471-2105-10-4

See also

Author

Kristen Yeh <kristenyeh@trentu.ca> Wesley Burr <wesleyburr@trentu.ca>

Examples

## Load sample dataset "bsline" data("bsline") ## Baseline correct using method "linear" linear <- baselineCorr(bsline, "mass", "raw", method = "linear", n = 7) ## Detect peaks using method "snr" snr <- peakDet(linear, "mz", "baseline", method = "snr", n = 7, SNR_thresh = 3)
#> 17725 peaks removed below SNR_thresh = 3
## Detect peaks using method "slopes" slopes <- peakDet(linear, "mz", "baseline", method = "slopes", n = 7)