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
)

Arguments

exp.spectrum

A data frame representing the experimental spectrum. This data frame should contain columns for 'mz' and 'intensity'.

lib.spectrum

A data frame representing the library spectrum. This data frame should contain columns for 'mz' and 'intensity'.

ppm.tol

A numeric value indicating the ppm tolerance.

mz.ppm.thr

A numeric value for m/z threshold for ppm calculation.

fraction.weight

A numeric value for weight of fraction component in score.

dp.forward.weight

A numeric value for weight of forward dot product component in score.

dp.reverse.weight

A numeric value for weight of reverse dot product component in score.

Value

A numeric value representing the similarity score between

exp.spectrum and lib.spectrum.

Details

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.

Examples

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