R/spectra_functions.R
getSpectraMatchScore.Rd
This function computes the similarity score between two mass spectra. The similarity is calculated based on a weighted sum of the fraction of matching peaks and dot products (forward and reverse).
getSpectraMatchScore(
exp.spectrum,
lib.spectrum,
ppm.tol = 30,
mz.ppm.thr = 400,
fraction.weight = 0.2,
dp.forward.weight = 0.7,
dp.reverse.weight = 0.1
)
A data frame representing the experimental spectrum. This data frame should contain columns for 'mz' and 'intensity'.
A data frame representing the library spectrum. This data frame should contain columns for 'mz' and 'intensity'.
A numeric value indicating the ppm tolerance.
A numeric value for m/z threshold for ppm calculation.
A numeric value for weight of fraction component in score.
A numeric value for weight of forward dot product component in score.
A numeric value for weight of reverse dot product component in score.
A numeric value representing the similarity score between
exp.spectrum
and lib.spectrum
.
The function scales the intensities of both spectra to a range of 0 to 1, identifies matching peaks, and computes a weighted similarity score using fraction of matching peaks and dot products. The function is deprecated, and users should transition to using the new function.
exp.spectrum <- data.frame(mz = 1:10, intensity = 1:10)
lib.spectrum <- data.frame(mz = 1:10, intensity = 1:10)
getSpectraMatchScore(exp.spectrum, lib.spectrum)
#> Warning: `getSpectraMatchScore()` was deprecated in masstools 0.99.9.
#> ℹ Please use `get_spectra_match_score()` instead.
#> [1] 1