Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in chromPeaks(from)[, "is_filled"] : subscript out of bounds #466

Closed
lecorguille opened this issue Apr 22, 2020 · 15 comments
Closed

Comments

@lecorguille
Copy link
Contributor

Hello,

Error in chromPeaks(from)[, "is_filled"] : subscript out of bounds

We are getting this errors at different steps : xcms, CAMERA ...
An example : https://help.galaxyproject.org/t/error-occured-during-the-camera-step/3298/4

I don't know yet if it's an issue with Galaxy, ReadMSData, XCMS ...
Any idea?

Thanks by advance

@jorainer
Copy link
Collaborator

As always, that's a problem of xcms (my fault :)): I moved this column from chromPeaks to chromPeakData. Reason: the former is a numeric matrix, the latter a DataFrame. We need less memory if we encode the "is_filled" as a logical instead of a numeric. You can solve your problem in two ways:

Setting isFilledChrom = TRUE in the chromPeaks call will append this column to the returned matrix:

chromPeaks(from, isFilledChrom = TRUE)[, "is_filled"]

Alternatively, you could access chromPeakData(from)$is_filled.

@lecorguille
Copy link
Contributor Author

Thanks for the quick answer.

But I don't use this function (or at least not directly)

The issue spot this function I wrote to chain XCMS3 and CAMERA

# This function retrieve a xset like object
#@author Gildas Le Corguille lecorguille@sb-roscoff.fr
getxcmsSetObject <- function(xobject) {
    # XCMS 1.x
    if (class(xobject) == "xcmsSet")
        return (xobject)
    # XCMS 3.x
    if (class(xobject) == "XCMSnExp") {
        # Get the legacy xcmsSet object
        suppressWarnings(xset <- as(xobject, 'xcmsSet'))
        if (!is.null(xset@phenoData$sample_group))
            sampclass(xset) <- xset@phenoData$sample_group
        else
            sampclass(xset) <- "."
        return (xset)
    }
}

Do you know if it comes from this : xset <- as(xobject, 'xcmsSet') ?

@sneumann
Copy link
Owner

Any chance of getting an example data set and code snippet as minimal working example ?
Yours, Steffen

@lecorguille
Copy link
Contributor Author

@yguitton, can we try to provide your dataset of 12 alg*.cdf

@jorainer
Copy link
Collaborator

Which version of xcms are you using? I don't see any call to chromPeaks(from)[, "is_filled"] in the current (dev) version.

@yguitton
Copy link

Hi all,
thanks for your help.

The files are available on zenodo.
I 've tried to create a R script, but it's not a working example...
#Issue 466
library(xcms)
TEMP<-tempdir()
download.file("https://zenodo.org/record/3631074/files/alg3.mzData", destfile=paste(TEMP,"alg3.mzData", sep="/"))
download.file("https://zenodo.org/record/3631074/files/alg7.mzData", destfile=paste(TEMP,"alg7.mzData", sep="/"))
download.file("https://zenodo.org/record/3631074/files/alg8.mzData", destfile=paste(TEMP,"alg8.mzData", sep="/"))
download.file("https://zenodo.org/record/3631074/files/alg9.mzData", destfile=paste(TEMP,"alg9.mzData", sep="/"))
download.file("https://zenodo.org/record/3631074/files/alg11.mzData", destfile=paste(TEMP,"alg11.mzData", sep="/"))

myfiles<-list.files(path=TEMP, pattern=".mzData")
raw_data <- readMSData(myfiles, mode = "onDisk")
mfp <- MatchedFilterParam(binSize = 0.5, fwhm = 15, max = 500, snthresh = 10, steps = 2)

##Check parameter
mfp

Perform the peak detection using matchecFilter on the files

res <- findChromPeaks(raw_data, param = mfp)
head(chromPeaks(res))

@jorainer
Copy link
Collaborator

Excellent! Thank you @yguitton !

Your code above works if you use myfiles <- list.files(path = TEMP, pattern = ".mzData", full.names = FALSE).

I did run the code above and got no error in xset <- as(res, "xcmsSet"). Might well be that the R/xcms version I am using has already a fix for this in it. My sessionInfo:

> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 10 (buster)

Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.3.5.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=C             
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] xcms_3.8.2          MSnbase_2.12.0      ProtGenerics_1.18.0
 [4] S4Vectors_0.24.4    mzR_2.20.0          Rcpp_1.0.4.6       
 [7] BiocParallel_1.20.1 Biobase_2.46.0      BiocGenerics_0.32.0
[10] BiocManager_1.30.10

loaded via a namespace (and not attached):
 [1] RColorBrewer_1.1-2     DEoptimR_1.0-8         compiler_3.6.3        
 [4] pillar_1.4.3           plyr_1.8.6             iterators_1.0.12      
 [7] zlibbioc_1.32.0        digest_0.6.25          ncdf4_1.17            
[10] MALDIquant_1.19.3      lifecycle_0.2.0        tibble_3.0.1          
[13] preprocessCore_1.48.0  gtable_0.3.0           lattice_0.20-41       
[16] pkgconfig_2.0.3        rlang_0.4.5            Matrix_1.2-18         
[19] foreach_1.5.0          dplyr_0.8.5            IRanges_2.20.2        
[22] vctrs_0.2.4            multtest_2.42.0        grid_3.6.3            
[25] tidyselect_1.0.0       robustbase_0.93-6      glue_1.4.0            
[28] impute_1.60.0          R6_2.4.1               survival_3.1-12       
[31] XML_3.99-0.3           RANN_2.6.1             limma_3.42.2          
[34] ggplot2_3.3.0          purrr_0.3.3            magrittr_1.5          
[37] splines_3.6.3          scales_1.1.0           pcaMethods_1.78.0     
[40] codetools_0.2-16       ellipsis_0.3.0         MASS_7.3-51.5         
[43] MassSpecWavelet_1.52.0 mzID_1.24.0            assertthat_0.2.1      
[46] colorspace_1.4-1       affy_1.64.0            doParallel_1.0.15     
[49] munsell_0.5.0          vsn_3.54.0             crayon_1.3.4          
[52] affyio_1.56.0         

So, with xcms version >= 3.8.2 you should be OK - which version of xcms do you have?

@jsaintvanne
Copy link

Hi @jorainer ,

We are using xcms 3.4.4 and I tried with xcms 3.8.1 and it looks that works ! So we probably have to update the xcms version of Galaxy

@jorainer
Copy link
Collaborator

If possible I suggest to update the R to the most recent one (4.0.0) - with this one you will also have the most recent version of Bioconductor (3.11).

@yguitton
Copy link

yguitton commented Apr 27, 2020

Ok for me with xcms 3.8.2 and R 4.0.0

`>sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C LC_TIME=French_France.1252

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

other attached packages:
[1] metaMS_1.22.0 CAMERA_1.43.2 xcms_3.8.2 MSnbase_2.13.4 ProtGenerics_1.19.3 S4Vectors_0.25.15
[7] mzR_2.21.1 Rcpp_1.0.4.6 BiocParallel_1.21.3 Biobase_2.47.3 BiocGenerics_0.33.3

loaded via a namespace (and not attached):
[1] bitops_1.0-6 matrixStats_0.56.0 doParallel_1.0.15 RColorBrewer_1.1-2
[5] GenomeInfoDb_1.23.17 tools_4.0.0 backports_1.1.6 R6_2.4.1
[9] affyio_1.57.0 rpart_4.1-15 Hmisc_4.4-0 colorspace_1.4-1
[13] nnet_7.3-13 gridExtra_2.3 compiler_4.0.0 MassSpecWavelet_1.53.0
[17] preprocessCore_1.49.2 graph_1.65.3 cli_2.0.2 htmlTable_1.13.3
[21] DelayedArray_0.13.12 scales_1.1.0 checkmate_2.0.0 DEoptimR_1.0-8
[25] robustbase_0.93-6 affy_1.65.1 RBGL_1.63.1 stringr_1.4.0
[29] digest_0.6.25 foreign_0.8-76 XVector_0.27.2 base64enc_0.1-3
[33] jpeg_0.1-8.1 pkgconfig_2.0.3 htmltools_0.4.0 limma_3.43.8
[37] htmlwidgets_1.5.1 rlang_0.4.5 rstudioapi_0.11 impute_1.61.0
[41] mzID_1.25.0 acepack_1.4.1 RCurl_1.98-1.2 magrittr_1.5
[45] GenomeInfoDbData_1.2.3 Formula_1.2-3 MALDIquant_1.19.3 Matrix_1.2-18
[49] munsell_0.5.0 fansi_0.4.1 lifecycle_0.2.0 vsn_3.55.0
[53] stringi_1.4.6 yaml_2.2.1 SummarizedExperiment_1.17.5 MASS_7.3-51.5
[57] zlibbioc_1.33.1 plyr_1.8.6 grid_4.0.0 crayon_1.3.4
[61] lattice_0.20-41 splines_4.0.0 multtest_2.43.1 knitr_1.28
[65] pillar_1.4.3 igraph_1.2.5 GenomicRanges_1.39.3 codetools_0.2-16
[69] XML_3.99-0.3 glue_1.4.0 latticeExtra_0.6-29 pcaMethods_1.79.1
[73] data.table_1.12.8 BiocManager_1.30.10 png_0.1-7 vctrs_0.2.4
[77] foreach_1.5.0 gtable_0.3.0 RANN_2.6.1 assertthat_0.2.1
[81] ggplot2_3.3.0 xfun_0.13 ncdf4_1.17 survival_3.1-12
[85] tibble_3.0.0 snow_0.4-3 iterators_1.0.12 IRanges_2.21.8
[89] cluster_2.1.0 ellipsis_0.3.0 `

@yguitton
Copy link

@jorainer it's working for xcms 3.8.2 BUT isn't with xcms 3.9.1

I get that

'> myfiles<-list.files(path=TEMP, pattern=".mzData", full.names=FALSE)
> setwd(TEMP)
> raw_data <- readMSData(myfiles, mode = "onDisk")
> mfp <- MatchedFilterParam(binSize = 0.5, fwhm = 15, max = 500, snthresh = 10, steps = 2)
> ##Check parameter
> mfp
Object of class:  MatchedFilterParam 
Parameters:
 binSize: 0.5 
Error in (function (classes, fdef, mtable)  : 
   unable to find an inherited method for function ‘impute’ for signature ‘"MatchedFilterParam"’'

any Idea ?
Yann

@jorainer
Copy link
Collaborator

I guess the generic definition of the impute method was moved from one to another package. I suggest that you bring all your packages up-to-date by calling BiocManager::install(), then it should work again. Also, this should install a more recent version of xcms (currently we have 3.9.5).

@yguitton
Copy link

@jorainer my problem is solved, Many Thanks.
Now we have to see how to deal with our initial issue under Galaxy. I'm pretty sure @lecorguille will find some magic.

@jorainer
Copy link
Collaborator

Just let me know if you need help

@jorainer
Copy link
Collaborator

Closing the issue now. Feel free to re-open if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants