sneumann / xcms

This is the git repository matching the Bioconductor package xcms: LC/MS and GC/MS Data Analysis
Other
178 stars 81 forks source link

retcor/getPeakGroupsRtMatrix error due to input NULL #175

Closed stanstrup closed 7 years ago

stanstrup commented 7 years ago

I have encountered some bug (I think) where retcor fails.

Processing 456338 mz slices ... OK
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘rowMedians’ for signature ‘"NULL"’

The input xcmsSet is quite small so I have attached it: xset_g.zip

My settings are:

$method
[1] "loess"

$plottype
[1] "deviation"

$span
[1] 0.6

$missing
[1] 2

$extra
[1] 2

traceback says:

19: stop(gettextf("unable to find an inherited method for function %s for signature %s", 
        sQuote(fdef@generic), sQuote(cnames)), domain = NA)
18: (function (classes, fdef, mtable) 
    {
        methods <- .findInheritedMethods(classes, fdef, mtable)
        if (length(methods) == 1L) 
            return(methods[[1L]])
        else if (length(methods) == 0L) {
            cnames <- paste0("\"", vapply(classes, as.character, 
                ""), "\"", collapse = ", ")
            stop(gettextf("unable to find an inherited method for function %s for signature %s", 
                sQuote(fdef@generic), sQuote(cnames)), domain = NA)
        }
        else stop("Internal error in finding inherited methods; didn't return a unique method", 
            domain = NA)
    })(list("NULL"), function (x, na.rm = FALSE, ...) 
    {
        if (missing(x)) {
            args <- list(...)
            if (is.element("imat", names(args))) {
                x <- args$imat
                .Deprecated(msg = "The name of the matrix argument for Biobase::rowMedians() has been changed from 'imat' to 'x'.")
            }
        }
        standardGeneric("rowMedians")
    }, <environment>)
17: rowMedians(rt, na.rm = TRUE)
16: order(rowMedians(rt, na.rm = TRUE))
15: .getPeakGroupsRtMatrix(peaks, peakIndex, nSamples, missingSample, 
        extraPeaks)
14: do_adjustRtime_peakGroups(peaks = peakmat, peakIndex = object@groupidx, 
        rtime = rtcor, minFraction = minFr, extraPeaks = extra, smooth = smooth, 
        span = span, family = family)
13: .local(object, ...)
12: (function (object, ...) 
    standardGeneric("retcor.peakgroups"))(object, smooth = method, 
        ...)
11: (function (object, ...) 
    standardGeneric("retcor.peakgroups"))(object, smooth = method, 
        ...)
10: do.call(retcor.peakgroups, alist(object, smooth = method, ...))
9: .local(object, ...)
8: (function (object, ...) 
   standardGeneric("retcor"))(method = "loess", plottype = "deviation", 
       span = 0.6, missing = 2, extra = 2, object = <S4 object of class "xcmsSet">)
7: (function (object, ...) 
   standardGeneric("retcor"))(method = "loess", plottype = "deviation", 
       span = 0.6, missing = 2, extra = 2, object = <S4 object of class "xcmsSet">)
6: do.call(retcor, c(settings$retcor1$parameters, list(object = xset_g)))
5: do.call(retcor, c(settings$retcor1$parameters, list(object = xset_g))) at 04_xcms_processing.R#84
4: eval(expr, envir, enclos)
3: eval(ei, envir)
2: withVisible(eval(ei, envir))
1: source("04_xcms_processing.R", local = FALSE, print.eval = TRUE)

Session:

sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=Danish_Denmark.1252  LC_CTYPE=Danish_Denmark.1252    LC_MONETARY=Danish_Denmark.1252 LC_NUMERIC=C                   
[5] LC_TIME=Danish_Denmark.1252    

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] chemhelper_0.6      obabel2R_0.5        CTSgetR_1.1         tibble_1.3.0        CAMERA_1.30.0       snow_0.4-2          xlsx_0.5.7         
 [8] xlsxjars_0.6.1      rJava_0.9-8         janitor_0.2.1       stringr_1.2.0       readxl_0.1.1        magrittr_1.5        MetabolomiQCsR_1.2 
[15] dplyr_0.5.0         listviewer_1.4.0    pacman_0.4.1        xcms_1.53.1         MSnbase_2.3.3       ProtGenerics_1.6.0  mzR_2.8.1          
[22] Rcpp_0.12.10        BiocParallel_1.8.2  Biobase_2.34.0      BiocGenerics_0.20.0 MASS_7.3-45        

loaded via a namespace (and not attached):
  [1] minqa_1.2.4            colorspace_1.3-2       rjson_0.2.15           dynamicTreeCut_1.63-1  rprojroot_1.2          htmlTable_1.9         
  [7] massageR_0.6           XVector_0.14.1         base64enc_0.1-3        MatrixModels_0.4-1     affyio_1.44.0          AnnotationDbi_1.36.2  
 [13] lubridate_1.6.0        codetools_0.2-15       splines_3.3.2          doParallel_1.0.10      impute_1.48.0          knitr_1.15.1          
 [19] itertools_0.1-3        Formula_1.2-1          jsonlite_1.4           nloptr_1.0.4           pbkrtest_0.4-7         packrat_0.4.8-1       
 [25] WGCNA_1.51             cluster_2.0.6          vsn_3.42.3             GO.db_3.4.0            png_0.1-7              graph_1.52.0          
 [31] readr_1.1.0            httr_1.2.1             backports_1.0.5        assertthat_0.1         Matrix_1.2-8           lazyeval_0.2.0        
 [37] limma_3.30.13          quantreg_5.29          acepack_1.4.1          htmltools_0.3.5        tools_3.3.2            igraph_1.0.1          
 [43] gtable_0.2.0           affy_1.52.0            RANN_2.5               reshape2_1.4.2         MALDIquant_1.16.2      RJSONIO_1.3-0         
 [49] Biostrings_2.42.1      multtest_2.30.0        nlme_3.1-131           preprocessCore_1.36.0  iterators_1.0.8        fastcluster_1.1.22    
 [55] lme4_1.1-12            devtools_1.12.0        XML_3.98-1.7           zlibbioc_1.20.0        scales_0.4.1           BiocInstaller_1.24.0  
 [61] pcaMethods_1.66.0      hms_0.3                fingerprint_3.5.4      RBGL_1.50.0            MassSpecWavelet_1.40.0 SparseM_1.76          
 [67] RColorBrewer_1.1-2     yaml_2.1.14            memoise_1.0.0          gridExtra_2.2.1        ggplot2_2.2.1.9000     rpart_4.1-10          
 [73] latticeExtra_0.6-28    stringi_1.1.5          RSQLite_1.1-2          S4Vectors_0.12.2       foreach_1.4.3          RMySQL_0.10.11        
 [79] checkmate_1.8.2        matrixStats_0.52.1     bitops_1.0-6           mzID_1.12.0            evaluate_0.10          lattice_0.20-35       
 [85] ChemmineR_2.26.1       purrr_0.2.2            htmlwidgets_0.8        plyr_1.8.4             R6_2.2.0               IRanges_2.8.2         
 [91] Hmisc_4.0-2            ini_0.2                DBI_0.6-1              mgcv_1.8-17            withr_1.0.2            vwr_0.3.0             
 [97] foreign_0.8-67         survival_2.41-3        KEGGREST_1.14.1        RCurl_1.95-4.8         nnet_7.3-12            car_2.1-4             
[103] rmarkdown_1.5          grid_3.3.2             rpubchem_1.5.10        data.table_1.10.4      digest_0.6.12          tidyr_0.6.1           
[109] Rdisop_1.34.0          pool_0.1.0             stats4_3.3.2           munsell_0.4.3         
jorainer commented 7 years ago

I'll look into that. Sounds like a namespace problem.

jorainer commented 7 years ago

Can't read the RDA you provided with R-3.3.2

> load("xset_g.rds")
Error: bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file ‘xset_g.rds’ has magic number 'X'
  Use of save versions prior to 2 is deprecated 
stanstrup commented 7 years ago

you need readRDS not load to read rds files.

xset_g <- readRDS("xset_g.rds")

jorainer commented 7 years ago

thanks!

jorainer commented 7 years ago

Thanks for pointing to this error. Actually, the error is thrown, because no hook peak groups were found for your settings. I'm catching this error now and show a better error message.

stanstrup commented 7 years ago

Thanks! Looks like I have big problems somewhere to detect the peaks.