xcms
                                
                                 xcms copied to clipboard
                                
                                    xcms copied to clipboard
                            
                            
                            
                        Error in profEIC
Hi,
when i use xcmsSet "getEIC" method, I am getting this issue:
xset = xcmsSet(fn, method = "centWave", peakwidth = c(5,20), ppm = 10, snthresh = 6, mzdiff = 0.01, prefilter = c(3,100), noise=100)
getEIC(xset,mzrange=matrix(xset@peaks[1970,c("mzmin","mzmax")],nrow = 1))
Error in profEIC(object, mzrange = mzrange, rtrange = rtrange, step = step) : 'mzrange' number 1 (49.4987898377907, 49.4993976984236) is outside of the mz value range of 'object'
file:StdMixLow.zip
sessionInfo()
R version 3.6.0 (2019-04-26) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936  LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936 LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936
attached base packages: [1] stats4 parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] xcms_3.8.2          MSnbase_2.12.0      ProtGenerics_1.18.0 S4Vectors_0.24.4    mzR_2.20.0          Rcpp_1.0.5
[7] BiocParallel_1.20.1 Biobase_2.46.0      BiocGenerics_0.32.0
loaded via a namespace (and not attached):
[1] vsn_3.54.0             tidyr_1.1.3            splines_3.6.0          foreach_1.5.0          assertthat_0.2.1
[6] statmod_1.4.34         BiocManager_1.30.10    affy_1.64.0            robustbase_0.93-6      impute_1.60.0
[11] numDeriv_2016.8-1.1    pillar_1.6.1           backports_1.1.7        lattice_0.20-38        glue_1.4.1
[16] limma_3.42.2           digest_0.6.25          RColorBrewer_1.1-2     minqa_1.2.4            colorspace_1.4-1
[21] preprocessCore_1.48.0  Matrix_1.2-17          plyr_1.8.6             MALDIquant_1.19.3      XML_3.99-0.3
[26] pkgconfig_2.0.3        broom_0.7.6            zlibbioc_1.32.0        purrr_0.3.4            scales_1.1.1
[31] RANN_2.6.1             affyio_1.56.0          lme4_1.1-23            tibble_3.1.1           generics_0.0.2
[36] IRanges_2.20.2         ggplot2_3.3.3          ellipsis_0.3.2         MassSpecWavelet_1.52.0 survival_3.2-7
[41] magrittr_2.0.1         crayon_1.4.1           ncdf4_1.17             fansi_0.4.1            doParallel_1.0.15
[46] nlme_3.1-139           MASS_7.3-51.4          tools_3.6.0            lifecycle_1.0.0        munsell_0.5.0
[51] pcaMethods_1.78.0      compiler_3.6.0         mzID_1.24.0            rlang_0.4.11           grid_3.6.0
[56] nloptr_1.2.2.2         iterators_1.0.12       boot_1.3-22            gtable_0.3.0           codetools_0.2-16
[61] lmerTest_3.1-2         multtest_2.42.0        DBI_1.1.0              R6_2.4.1               dplyr_1.0.6
[66] utf8_1.1.4             vctrs_0.3.8            DEoptimR_1.0-8         tidyselect_1.1.0    `
thanks
May I suggest to use the new functions instead of the deprecated xcmsSet code? That will also make it easier for me to find the origin of the problem. Also, if I remember correctly, getEIC was calculating first the profile matrix binning data along the m/z dimension. Thus the returned EIC was not exactly representing the raw data (on which centWave performed the peak detection).
You should be able to do the same as above with:
data <- readMSData(fn, mode = "onDisk")
cwp <- CentWaveParam(
    peakwidth = c(5, 20),
    ppm = 10,
    snthresh = 6,
    mzdiff = 0.01, 
    prefilter = c(3, 100),
    noise = 100)
xdata <- findChromPeaks(data, cwp)
eics <- chromatogram(xdata, mz = chromPeaks(xdata)[1970, c("mzmin", "mzmax")])