Match m/z values using interval overlaps
match_mz_foverlaps.RdMatch two numeric m/z vectors within a ppm tolerance using
data.table::foverlaps() on ppm-expanded intervals.
The function returns index pairs (ion1, ion2) and the ppm error (mz.ppm).
When length(mz1) > length(mz2), it builds intervals around mz2 using a
global window derived from max(ppm.base), then filters to the final ppm.
Arguments
- mz1
Numeric vector of m/z values (query set 1).
- mz2
Numeric vector of m/z values (query set 2).
- ppm.base
Numeric vector used as ppm denominator. Defaults to
mz1. For typical use,ppm.baseshould have the same length as the set referenced byion1in the returned table (usuallymz1).- ppm
Numeric scalar ppm tolerance (default 10).