Sanitize spectra

Description

This function sanitizes MS spectra by removing noise, artifacts, precursor peaks, and empty spectra. It applies multiple cleaning steps including intensity filtering, peak reduction, and normalization.

Usage

sanitize_spectra(spectra, cutoff = 0, dalton = 0.01, ppm = 10)

Arguments

spectra Spectra object from the Spectra package
cutoff Numeric absolute minimal intensity threshold (default: 0). Peaks below this intensity are removed.
dalton Numeric Dalton tolerance for peak matching (default: 0.01)
ppm Numeric PPM tolerance for peak matching (default: 10)

Value

A sanitized Spectra object with noise and artifacts removed

Examples

library("tima")

data.frame(
  FEATURE_ID = c("FT001", "FT002", "FT003"),
  mz = c(list(123.4567, 234.5678, 345.6789))
) |>
  Spectra::Spectra() |>
  sanitize_spectra()