-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Labels
Description
Calling e.g. xmse[4, keepAdjustedRtime = FALSE]
on an XcmsExperiment
object after retention time alignment will correctly revert the retention times, but not revert the "rt"
, "rtmin"
and "rtmax"
values of chromatographic peaks. The retention time information for chromatographic peaks will still be the adjusted retention times. Note that this does only affect the XcmsExperiment
, but not the XCMSnExp
result object.
This is a clear bug we need to fix ASAP in both the release and devel branch!
A reproducible example:
library(xcms)
library(MsExperiment)
library(testthat)
fls <- c(system.file('cdf/KO/ko15.CDF', package = "faahKO"),
system.file('cdf/KO/ko16.CDF', package = "faahKO"),
system.file('cdf/KO/ko18.CDF', package = "faahKO"))
df <- data.frame(mzML_file = basename(fls),
dataOrigin = fls,
sample = c("ko15", "ko16", "ko18"))
mse <- readMsExperiment(spectraFiles = fls, sampleData = df)
cwp <- CentWaveParam(noise = 10000, snthresh = 40, prefilter = c(3, 10000))
xmse <- findChromPeaks(mse, param = cwp)
pdp <- PeakDensityParam(sampleGroups = rep(1, 3))
xmse <- groupChromPeaks(xmse, param = pdp, add = FALSE)
xmse <- adjustRtime(xmse, PeakGroupsParam(span = 0.4))
## Subsetting with/without keeping adjusted retention times
a <- xmse[3, keepAdjustedRtime = TRUE]
b <- tmp[3, keepAdjustedRtime = FALSE]
## retention times are expected to be different
expect_false(all(rtime(a) == rtime(b)))
## retention times of chrom peaks would also be expected to be different
## but they are not
expect_false(all(chromPeaks(a)[, "rt"] == chromPeaks(b)[, "rt"]))
Error: all(chromPeaks(a)[, "rt"] == chromPeaks(b)[, "rt"]) is not FALSE
`actual`: TRUE
`expected`: FALSE