Matches fragments in experimental and library spectra based on their m/z values within a given ppm tolerance. Noisy fragments are removed before matching.

ms2Match(exp.spectrum, lib.spectrum, ppm.tol = 30, mz.ppm.thr = 400)

Arguments

exp.spectrum

A data frame representing the experimental spectrum with columns for m/z and intensity.

lib.spectrum

A data frame representing the library spectrum with columns for m/z and intensity.

ppm.tol

A numeric value specifying the ppm tolerance for matching fragments. Default is 30.

mz.ppm.thr

A numeric value for the m/z threshold. Default is 400.

Value

A data frame with columns for library index, experimental index, library m/z, library intensity, experimental m/z, and experimental intensity.

Details

For each fragment in the library spectrum, the function searches for a matching fragment in the experimental spectrum based on the specified ppm tolerance. Prior to matching, noisy fragments are removed from both spectra using the `remove_noise` function. The resulting data frame provides matched fragments as well as unmatched fragments from both spectra.

Examples

exp.spectrum <- data.frame(mz = 1:10, intensity = 1:10)
lib.spectrum <- data.frame(mz = 1:10, intensity = 1:10)
ms2Match(exp.spectrum, lib.spectrum)
#> Warning: `ms2Match()` was deprecated in masstools 0.99.9.
#>  Please use `ms2_match()` instead.
#>    Lib.index Exp.index Lib.mz Lib.intensity Exp.mz Exp.intensity
#> 1          1         1      1             1      1             1
#> 2          2         2      2             2      2             2
#> 3          3         3      3             3      3             3
#> 4          4         4      4             4      4             4
#> 5          5         5      5             5      5             5
#> 6          6         6      6             6      6             6
#> 7          7         7      7             7      7             7
#> 8          8         8      8             8      8             8
#> 9          9         9      9             9      9             9
#> 10        10        10     10            10     10            10