| Title: | CentroidR |
|---|---|
| Description: | CentroidR provides the infrastructure to centroid profile spectra. |
| Authors: | Adriano Rutz [aut, cre] (ORCID: <https://orcid.org/0000-0003-0443-9902>), Johannes Rainer [aut] (ORCID: <https://orcid.org/0000-0002-6977-7147>) |
| Maintainer: | Adriano Rutz <[email protected]> |
| License: | AGPL (>= 3) |
| Version: | 0.0.0.9004 |
| Built: | 2026-10-17 09:38:43 UTC |
| Source: | https://github.com/adafede/CentroidR |
This function processes an mzML file to apply centroiding with detailed controls for peak picking, smoothing, and noise estimation. It allows fine-tuning of MS1 and MS2 peak detection, optimizing spectral data analysis for various experimental needs.
centroid_one_file( file, pattern, replacement, min_datapoints_ms1 = 5L, min_datapoints_ms2 = 1L, mz_tol_da_ms1 = 0.0025, mz_tol_da_ms2 = 0.0025, mz_tol_ppm_ms1 = 5, mz_tol_ppm_ms2 = 5, mz_fun_ms1 = base::mean, mz_fun_ms2 = base::mean, int_fun_ms1 = base::max, int_fun_ms2 = base::max, mz_weighted = TRUE, time_domain = TRUE, intensity_exponent = 3 )centroid_one_file( file, pattern, replacement, min_datapoints_ms1 = 5L, min_datapoints_ms2 = 1L, mz_tol_da_ms1 = 0.0025, mz_tol_da_ms2 = 0.0025, mz_tol_ppm_ms1 = 5, mz_tol_ppm_ms2 = 5, mz_fun_ms1 = base::mean, mz_fun_ms2 = base::mean, int_fun_ms1 = base::max, int_fun_ms2 = base::max, mz_weighted = TRUE, time_domain = TRUE, intensity_exponent = 3 )
file |
character(1). Path to the input mzML file. Must be a valid, accessible mzML format file. |
pattern |
character(1). Regular expression pattern to match in the input file path, used for modifying the output file path. |
replacement |
character(1). Replacement string for altering the output
file path based on the |
min_datapoints_ms1 |
integer(1). Minimum datapoints to be considered for MS1 data. Must be at least 1. Default: 5L. |
min_datapoints_ms2 |
integer(1). Minimum datapoints to be considered for MS2 data. Must be at least 1. Default: 1L. |
mz_tol_da_ms1 |
numeric(1). m/z tolerance in Daltons for MS1 data. Default: 0.0025. |
mz_tol_da_ms2 |
numeric(1). m/z tolerance in Daltons for MS2 data. Default: 0.0025. |
mz_tol_ppm_ms1 |
numeric(1). m/z tolerance in parts per million (ppm) for MS1. Default: 5. |
mz_tol_ppm_ms2 |
numeric(1). m/z tolerance in parts per million (ppm) for MS2. Default: 5. |
mz_fun_ms1 |
function. Function to aggregate m/z values within each
peak group (MS1). Ignored if |
mz_fun_ms2 |
function. Function to aggregate m/z values within each
peak group (MS2). Ignored if |
int_fun_ms1 |
function. Function to aggregate peak intensities within each peak group (MS1). Default: base::max. |
int_fun_ms2 |
function. Function to aggregate peak intensities within each peak group (MS2). Default: base::max. |
mz_weighted |
logical(1). If |
time_domain |
logical(1). If |
intensity_exponent |
numeric(1). If |
MS1 and MS2 spectra are processed separately with their own tolerances, so the two levels can be tuned independently.
Within a spectrum, profile points are grouped by the m/z tolerances, a group
is split back into separate peaks at deep valleys so that closely spaced
peaks are not merged, and each group is reduced to a single peak. A group is
only reduced when it holds at least min_datapoints_ms* points of non-zero
intensity; below that it is reported as zero intensity and filtered out.
Spectra left without any peak by this step are restored from the input, so
no spectrum is lost.
File path modifications are supported via pattern and replacement.
pattern is a regular expression, as in sub().
logical(1). TRUE if the file was centroided, or TRUE if it was
skipped because the output file already existed; FALSE if the input was
missing or if centroiding failed. Invalid argument types raise an error
instead of returning FALSE.
Johannes Rainer, Adriano Rutz
## Not run: # Example usage (requires an mzML file): # centroid_one_file( # file = "raw_data.mzML", # pattern = "\.mzML$", # replacement = "_centroided.mzML", # min_datapoints_ms1 = 5L, # min_datapoints_ms2 = 1L # ) ## End(Not run)## Not run: # Example usage (requires an mzML file): # centroid_one_file( # file = "raw_data.mzML", # pattern = "\.mzML$", # replacement = "_centroided.mzML", # min_datapoints_ms1 = 5L, # min_datapoints_ms2 = 1L # ) ## End(Not run)