Computes modern spectral similarity metrics including Cosine similarity, intensity-weighted dot product, and log-likelihood between observed mass spectral peaks and theoretical isotopic distributions.
Arguments
- obs_mz
Numeric vector of observed m/z values.
- obs_int
Numeric vector of observed intensities.
- theo_mz
Numeric vector of theoretical isotopic m/z values.
- theo_int
Numeric vector of theoretical isotopic abundances.
- tolerance
Numeric mass tolerance for peak alignment (default: 0.005).
- ppm
Logical indicating whether
toleranceis in ppm (default: FALSE).
Value
A list containing:
- cosine
Cosine similarity (unweighted dot product of normalized spectra).
- weighted_cosine
Mass- and intensity-weighted dot product (MassBank/NIST style).
- log_likelihood
Multinomial log-likelihood of observed peak distribution.
- matched_peaks
Integer count of successfully matched peaks.