Closed lgatto closed 1 year ago
The last commit implements what what discussed in #258
> sciex_file <- dir(system.file("sciex", package = "msdata"),
+ full.names = TRUE)
+ sciex <- Spectra(sciex_file, backend = MsBackendMzR())
> x1 <- containsMz(sciex, mz = c(123.7, NA, 109.07), which = "any")
> x2 <- containsMz(sciex, mz = c(109.07, 123.7, NA), which = "any")
> x3 <- containsMz(sciex, mz = c(109.07, 123.7), which = "any")
> identical(x1, x2)
[1] TRUE
> identical(x1, x3)
[1] TRUE
@jorainer - could you approve and/or merge, if you are OK with the PR
I'm wondering if this check should not go into the (backend) validator methods? That should/could be more efficient since the check would only called once instead of each time the function e.g.
containsMz
is called. AFAIK we require the m/z values to be sorted. TheMsBackendDataFrame
has this check (https://github.com/rformassspectrometry/Spectra/blob/master/R/MsBackendDataFrame-functions.R#L55:L63) - maybe we should add a validator method for theMsBackend
class and add the sorted m/z check there?