View source: R/calc_recalibrate_ms.R
| calc_recalibrate_ms | R Documentation |
This function performs an automated mass recalibration for peak lists using predefined or user-specified calibrant lists.
Calibration can be based on existing calibrant tables included in ume::known_mf
(via the calibr_list argument) or on a user-provided set of molecular formulas
(custom_calibr_list).
The function assigns calibrant peaks to each spectrum and evaluates their mass accuracy. Three independent outlier tests are applied to the assigned calibrants, and only those that pass all tests are used to calculate the recalibration model.
Recalibration is performed using a linear model (m ~ m_cal), and spectra with
insufficient calibrant matches can be either excluded or corrected using
extrapolated calibration parameters.
calc_recalibrate_ms(
pl,
col_spectrum_id = "file_id",
calibr_list = c("cal_fa_neg", "cal_marine_dom_neg", "calibration", "marine_dom",
"cal_marine_dom_pos", "cal_marine_pw_neg", "cal_SRFA_neg", "cal_SRFA_OL_neg",
"E_coli_metabolome", "Post-column standard"),
custom_calibr_list = NULL,
min_no_calibrants = 1,
outlier_removal = TRUE,
insufficient_calibrants = c("extrapolate", "remove_spectrum"),
verbose = FALSE,
pol = c("neg", "pos", "neutral"),
ma_dev,
...
)
pl |
data.table containing peak data. Mandatory columns include neutral
molecular mass ( |
col_spectrum_id |
Character. Name of the column that identifies individual
spectra or samples (default: |
calibr_list |
Character string. Name of a predefined calibrant list stored in
|
custom_calibr_list |
Character vector. Custom list of molecular formulas to be used as calibrants instead of a predefined list. |
min_no_calibrants |
Integer. Minimum number of calibrant peaks required per
spectrum to perform recalibration (default: 3). If fewer calibrants are found,
recalibration is skipped or handled according to |
outlier_removal |
Logical. If |
insufficient_calibrants |
Character. Defines how spectra with too few calibrants are handled:
|
verbose |
logical; if |
... |
Arguments passed on to
|
Recalibration is based on a linear fit (lm(m ~ m_cal)), with slopes and intercepts
computed individually for each spectrum. Optionally, spectra without sufficient
calibrants can be corrected using median calibration parameters derived from
other spectra.
A list containing:
plRecalibrated peaklist.
checkSummary of the number of calibrants per spectrum.
cal_peaksAssigned calibrant peaks and recalibration results.
cal_statsCalibration statistics (slopes, intercepts, accuracy metrics).
fig_*Interactive plotly figures comparing mass accuracy before and after recalibration.
Boris P. Koch
Other calculations:
calc_data_summary(),
calc_dbe(),
calc_eval_params(),
calc_exact_mass(),
calc_ideg(),
calc_ma(),
calc_neutral_mass(),
calc_nm(),
calc_norm_int(),
calc_number_assignment(),
calc_number_occurrence()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.