This function calculates the neutral mass (M) from an observed m/z value and adduct notation. It accounts for charge, multimers, isotopes, and adduct modifications.
The calculation follows the formula:
M = (|z| * (m/z - iso_shift) - modifications + z * e_mass) / n_mer
where:
- |z| = absolute number of charges
- z = signed charge (`|z| * polarity`)
- m/z = observed mass-to-charge ratio
- iso_shift = `n_iso * ISOTOPE_MASS_SHIFT_DALTONS`
- modifications = total neutral mass change from adduct modifications
- e_mass = electron mass
- n_mer = multimer count
numeric Observed m/z value in Daltons. Must be positive.
adduct_string
character Adduct notation string (e.g., [M+H]+, [2M+Na]+, [M-H2O+H]+)
electron_mass
numeric Electron mass in Daltons (default: ELECTRON_MASS_DALTONS from constants.R - CODATA 2018 value)
Value
Numeric neutral mass (M) in Daltons. Returns 0 if: - Adduct parsing fails - Invalid input parameters - Division by zero would occur (n_mer = 0 or n_charges = 0) Returns NA if calculated mass is negative (physically impossible)
See Also
Other mass-spectrometry: calculate_mz_from_mass(), calculate_similarity(), harmonize_adducts(), import_spectra(), parse_adduct()