sneumann / xcms

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

The error message encountered when using the "IPO" package #733

Closed v-v1150n closed 3 months ago

v-v1150n commented 3 months ago

My code:

library(faahKO) library(IPO) datapath <- system.file("cdf", package = "faahKO") datafiles <- list.files(datapath, recursive = TRUE, full.names = TRUE)

paramall <- getDefaultXcmsSetStartingParams(method = c("centWave", "matchedFilter")) resultPeakpicking <- optimizeXcmsSet(files = datafiles[1:1], params = paramall, isotopeIdentification = c("IPO", "CAMERA"), nSlaves = 0, plot = TRUE)

The error message encountered when using the "IPO" package is as follows:

starting new DoE with: min_peakwidth: c(12, 28) max_peakwidth: c(35, 65) ppm: c(17, 32) mzdiff: c(-0.001, 0.01) snthresh: 10 noise: 0 prefilter: 3 value_of_prefilter: 100 mzCenterFun: wMean integrate: 1 fitgauss: FALSE verbose.columns: FALSE

1 Detecting mass traces at 17 ppm ... OK Detecting chromatographic peaks in 39815 regions of interest ... OK: 3156 found.

Error in xcms::xcmsSet(files = files, method = "centWave", peakwidth = c(xcmsSetParameters$min_peakwidth[task], : Chromatographic peak detection failed for all files! The first error was: Error in validObject(.Object): invalid class “xcmsPeaks” object: superclass "mMatrix" not defined in the environment of the object's class

Executing the official example code failed to execute successfully It is currently not possible to determine whether it is a version issue or a file issue. The file is a CDF file in "faahKO" using the example

jorainer commented 3 months ago

This is related to issue #730 as well as #700. It's all some odd behavior do to changes in the Matrix package. I didn't find any solution for this yet, as it needs to be fixed upstream. Note also that xcmsSet xcmsPeaks etc are deprecated classes and functionality. We strongly suggest to update to the new classes and functionality/interface.

v-v1150n commented 3 months ago

This is related to issue #730 as well as #700. It's all some odd behavior do to changes in the Matrix package. I didn't find any solution for this yet, as it needs to be fixed upstream. Note also that xcmsSet xcmsPeaks etc are deprecated classes and functionality. We strongly suggest to update to the new classes and functionality/interface.

Thank you for your reply. I would like to ask another question to rule out upstream issues. Is it a normal test procedure for me to first use the .cdf file provided by "faahKO" to try out the "IPO" function? Because I am new to the R language, I am not sure if the .cdf file (GC-MS) I have received currently has file problems.

jorainer commented 3 months ago

I think the real problem here is that IPO still uses the old (and deprecated) classes from xcms. Ideally, they should update to our newer and more robust data structures.

But this does not solve your problem here ... so let's try to fix that. Can you please provide the output of your sessionInfo() here? I guess we can solve this through (re)installation of some packages.

v-v1150n commented 3 months ago

I think the real problem here is that IPO still uses the old (and deprecated) classes from xcms. Ideally, they should update to our newer and more robust data structures.

But this does not solve your problem here ... so let's try to fix that. Can you please provide the output of your sessionInfo() here? I guess we can solve this through (re)installation of some packages.

I have just deleted and reinstalled all R and bioconductor related packages. They should all be the latest versions now. The following provides my sessionInfo() content. Thank you for your help!

sessionInfo() R version 4.3.3 (2024-02-29) Platform: aarch64-apple-darwin20 (64-bit) Running under: macOS Sonoma 14.0

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Asia/Taipei tzcode source: internal

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

other attached packages: [1] faahKO_1.42.0 MsExperiment_1.4.0 MetaboAnnotation_1.6.1 MsBackendMsp_1.6.0
[5] Spectra_1.12.0 IPO_1.28.0 CAMERA_1.58.0 rsm_2.10.4
[9] xcms_4.0.2 MSnbase_2.28.1 ProtGenerics_1.34.0 S4Vectors_0.40.2
[13] mzR_2.36.0 Rcpp_1.0.12 Biobase_2.62.0 BiocGenerics_0.48.1
[17] BiocParallel_1.36.0

loaded via a namespace (and not attached): [1] splines_4.3.3 later_1.3.2 bitops_1.0-7
[4] filelock_1.0.3 tibble_3.2.1 preprocessCore_1.64.0
[7] graph_1.80.0 XML_3.99-0.16.1 rpart_4.1.23
[10] lifecycle_1.0.4 doParallel_1.0.17 lattice_0.22-5
[13] MASS_7.3-60.0.1 MultiAssayExperiment_1.28.0 backports_1.4.1
[16] magrittr_2.0.3 limma_3.58.1 Hmisc_5.1-2
[19] rmarkdown_2.26 yaml_2.3.8 httpuv_1.6.14
[22] MsCoreUtils_1.14.1 DBI_1.2.2 RColorBrewer_1.1-3
[25] abind_1.4-5 zlibbioc_1.48.2 GenomicRanges_1.54.1
[28] AnnotationFilter_1.26.0 RCurl_1.98-1.14 nnet_7.3-19
[31] rappdirs_0.3.3 GenomeInfoDbData_1.2.11 IRanges_2.36.0
[34] ncdf4_1.22 codetools_0.2-19 CompoundDb_1.6.0
[37] DelayedArray_0.28.0 DT_0.32 xml2_1.3.6
[40] tidyselect_1.2.1 matrixStats_1.2.0 BiocFileCache_2.10.1
[43] base64enc_0.1-3 jsonlite_1.8.8 multtest_2.58.0
[46] ellipsis_0.3.2 Formula_1.2-5 survival_3.5-8
[49] iterators_1.0.14 foreach_1.5.2 tools_4.3.3
[52] progress_1.2.3 glue_1.7.0 gridExtra_2.3
[55] SparseArray_1.2.4 xfun_0.42 MatrixGenerics_1.14.0
[58] GenomeInfoDb_1.38.8 dplyr_1.1.4 BiocManager_1.30.22
[61] fastmap_1.1.1 fansi_1.0.6 digest_0.6.35
[64] R6_2.5.1 mime_0.12 colorspace_2.1-0
[67] rsvg_2.6.0 RSQLite_2.3.5 utf8_1.2.4
[70] generics_0.1.3 data.table_1.15.2 robustbase_0.99-2
[73] prettyunits_1.2.0 httr_1.4.7 htmlwidgets_1.6.4
[76] S4Arrays_1.2.1 pkgconfig_2.0.3 gtable_0.3.4
[79] blob_1.2.4 impute_1.76.0 MassSpecWavelet_1.68.0
[82] XVector_0.42.0 htmltools_0.5.7 RBGL_1.78.0
[85] MALDIquant_1.22.2 clue_0.3-65 scales_1.3.0
[88] png_0.1-8 knitr_1.45 MetaboCoreUtils_1.10.0
[91] rstudioapi_0.15.0 rjson_0.2.21 checkmate_2.3.1
[94] curl_5.2.1 cachem_1.0.8 stringr_1.5.1
[97] BiocVersion_3.18.1 parallel_4.3.3 AnnotationDbi_1.64.1
[100] foreign_0.8-86 mzID_1.40.0 vsn_3.70.0
[103] pillar_1.9.0 grid_4.3.3 vctrs_0.6.5
[106] MsFeatures_1.10.0 RANN_2.6.1 pcaMethods_1.94.0
[109] promises_1.2.1 dbplyr_2.5.0 xtable_1.8-4
[112] cluster_2.1.6 htmlTable_2.4.2 evaluate_0.23
[115] cli_3.6.2 compiler_4.3.3 rlang_1.1.3
[118] crayon_1.5.2 QFeatures_1.12.0 ChemmineR_3.54.0
[121] affy_1.80.0 plyr_1.8.9 fs_1.6.3
[124] stringi_1.8.3 Biostrings_2.70.3 munsell_0.5.0
[127] lazyeval_0.2.2 Matrix_1.6-5 hms_1.1.3
[130] bit64_4.0.5 ggplot2_3.5.0 KEGGREST_1.42.0
[133] statmod_1.5.0 shiny_1.8.0 SummarizedExperiment_1.32.0
[136] interactiveDisplayBase_1.40.0 AnnotationHub_3.10.0 igraph_2.0.3
[139] memoise_2.0.1 affyio_1.72.0 DEoptimR_1.1-3
[142] bit_4.0.5

jorainer commented 3 months ago

Can you please try to re-install the Matrix and xcms packages from source?

You should be able to do this (assuming you have the BiocManager package installed with install.packages("BiocManager")):

BiocManager::install(c("Matrix", "xcms"), type = "source", force = TRUE)
v-v1150n commented 3 months ago

Can you please try to re-install the Matrix and xcms packages from source?

You should be able to do this (assuming you have the BiocManager package installed with install.packages("BiocManager")):

BiocManager::install(c("Matrix", "xcms"), type = "source", force = TRUE)

I reinstalled Matrix and xcms, and ran the code just now and got the following results, but I am not sure if this is the normal success situation, or if I am fine-tuning the detection range of parameters (I will take one part) :

26 Scanning files in directory /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/faahKO/cdf ... found 12 files Detecting mass traces at 24.5 ppm ... OK Detecting chromatographic peaks in 40258 regions of interest ... OK: 1788 found. Detecting mass traces at 24.5 ppm ... OK Detecting chromatographic peaks in 40870 regions of interest ... OK: 2063 found.

Detecting mass traces at 24.5 ppm ... OK Detecting chromatographic peaks in 39660 regions of interest ... OK: 2026 found. Detecting mass traces at 24.5 ppm ... OK Detecting chromatographic peaks in 39057 regions of interest ... OK: 1953 found.

Detecting mass traces at 24.5 ppm ... OK Detecting chromatographic peaks in 39820 regions of interest ... OK: 1969 found. Detecting mass traces at 24.5 ppm ... OK Detecting chromatographic peaks in 39479 regions of interest ... OK: 1894 found.

Detecting mass traces at 24.5 ppm ... OK Detecting chromatographic peaks in 40893 regions of interest ... OK: 2013 found. Detecting mass traces at 24.5 ppm ... OK Detecting chromatographic peaks in 40991 regions of interest ... OK: 2039 found.

Detecting mass traces at 24.5 ppm ... OK Detecting chromatographic peaks in 40034 regions of interest ... OK: 2244 found. Detecting mass traces at 24.5 ppm ... OK Detecting chromatographic peaks in 39645 regions of interest ... OK: 2271 found.

Detecting mass traces at 24.5 ppm ... OK Detecting chromatographic peaks in 39815 regions of interest ... OK: 2220 found. Detecting mass traces at 24.5 ppm ... OK Detecting chromatographic peaks in 39434 regions of interest ... OK: 2377 found.

Error in units != "px" && is.na(res) : 'length = 2' in coercion to 'logical(1)'

sneumann commented 3 months ago

Can you provide the output of traceback() after the error about units ? That can give a hint where the issue is. As Johannes mentioned, issues in xcmsSet related functions are unlikely to get fixed, unless someone provides a pull request with the fix. If things don't work anymore, we'll rather remove xcmsSet and friends, since the replacements have much better functionality. Yours, Steffen

v-v1150n commented 3 months ago

Can you provide the output of traceback() after the error about units ? That can give a hint where the issue is. As Johannes mentioned, issues in xcmsSet related functions are unlikely to get fixed, unless someone provides a pull request with the fix. If things don't work anymore, we'll rather remove xcmsSet and friends, since the replacements have much better functionality. Yours, Steffen

Hi, Mr. Neumann I just tested that the official IPO code can run successfully, but when I put peakpickingParameters <- getDefaultXcmsSetStartingParams(method = c("centWave", "matchedFilter")) will cause an error after changing to this mode The following is the content of traceback():

traceback() 3: stop(paste("No isotopes have been detected,", "peak picking not optimal by IPO!")) 2: resultIncreased(history) 1: optimizeXcmsSet(files = datafiles[1:2], params = peakpickingParameters, nSlaves = 1, subdir = NULL, plot = TRUE)

Does this mean my params adjustment needs to be changed? Or is it still a problem related to xcmsSet?

sneumann commented 3 months ago

Hi, frankly, I don't know the IPO code guts well enough to help. The traceback shows this is rather something in the IPO code. The No isotopes is part of the IPO scoring, that determines "good" picking by having many isotope clusters. I am unsure if that is due to instrument accuracy or software parameters trying to detect the isotope mass difference. Another thing I see above is that I can't remember whether method = c("centWave", "matchedFilter") is allowed, maybe you can provide one of the methods, but not both of them ? Yours, Steffen

v-v1150n commented 3 months ago

maybe you can provide one of the methods, but not both of them ? Yours, Steffen

I think the problem with xcms should be solved for the time being. I am currently trying other parameters and files. If I encounter any problems related to xcms, I will raise them. Thank you for your help.