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) - modifications - (z * sign * e_mass)) / n_mer)
where:
- z = number of charges
- m/z = observed mass-to-charge ratio
- iso = isotope shift (mass units)
- modifications = total mass change from adduct modifications
- sign = charge polarity (+1 or -1)
- 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()