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

adjustRtime Errors #777

Open
jzhou19 opened this issue Nov 6, 2024 · 4 comments
Open

adjustRtime Errors #777

jzhou19 opened this issue Nov 6, 2024 · 4 comments

Comments

@jzhou19
Copy link

jzhou19 commented Nov 6, 2024

Hello,

adjustRtime gave me the following errors when attempting with xdata = adjustRtime(xdata, param = ObiwarpParam(binSize = 0.6))

Error in manager$availability[[as.character(result$node)]] <- TRUE : wrong args for environment subassignment
Error in serialize(data, node$con) : error writing to connection

I tried register(SerialParam()) as suggested in #766 but ended up with the "R session aborted" error.

Below are the steps I took prior to performing alignment:

## Load data
raw_data = readMsExperiment(spectraFiles = files, sampleData = phenodata)

## Subset based on retention time
raw_data = filterRt(raw_data, c(60, 1000))

## Perform chromatographic peak detection in this section
## Peak detection parameters
cwp = CentWaveParam(
  peakwidth       = c(16.25, 57.75), # expected approximate peak width in chromatographic space
  ppm             = 10,            # maximal tolerated m/z deviation
  noise           = 1000000,          # minimum intensity required for centroids to be considered
  snthresh        = 10,              # defining the signal to noise ratio cutoff
  mzdiff          = -0.0065,         # minimum difference in m/z dimension required for peaks with overlapping retention times
  prefilter       = c(3.7, 100),       # Mass traces are only retained if they contain at least 3 peaks with intensity >= 200
  mzCenterFun     = "wMean",         # function to calculate the m/z center of the chromatographic peak
  integrate       = 2,               # Integration method, for 2 the descent is done on the real data
  fitgauss        = TRUE,            # whether or not a Gaussian should be fitted to each peak
  verboseColumns  = FALSE)           # whether additional peak meta data columns should be returned

## Peak detection on the full data set
xdata = findChromPeaks(raw_data, param = cwp)

## Merge neighboring chromatographic peaks
mpp = MergeNeighboringPeaksParam(
  expandMz = 0.0005, 
  expandRt = 5, 
  ppm = 10) 
xdata = refineChromPeaks(xdata, mpp)

For your information, print(object.size(xdata), unit = "MB") reported 40.4 Mb

Session Info as follows:

R version 4.4.1 (2024-06-14 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8

time zone: America/Chicago
tzcode source: internal

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

other attached packages:
[1] MsExperiment_1.8.0 ProtGenerics_1.38.0 SummarizedExperiment_1.36.0
[4] Biobase_2.64.0 GenomicRanges_1.56.2 GenomeInfoDb_1.42.0
[7] IRanges_2.38.1 S4Vectors_0.44.0 BiocGenerics_0.52.0
[10] MatrixGenerics_1.18.0 matrixStats_1.4.1 xcms_4.4.0
[13] BiocParallel_1.40.0

loaded via a namespace (and not attached):
[1] tidyselect_1.2.1 dplyr_1.1.4 lazyeval_0.2.2
[4] MassSpecWavelet_1.70.0 digest_0.6.37 XML_3.99-0.17
[7] lifecycle_1.0.4 cluster_2.1.6 statmod_1.5.0
[10] magrittr_2.0.3 compiler_4.4.1 progress_1.2.3
[13] rlang_1.1.4 tools_4.4.1 igraph_2.1.1
[16] utf8_1.2.3 prettyunits_1.2.0 S4Arrays_1.6.0
[19] DelayedArray_0.32.0 plyr_1.8.9 RColorBrewer_1.1-3
[22] abind_1.4-8 purrr_1.0.2 grid_4.4.1
[25] preprocessCore_1.66.0 fansi_1.0.4 colorspace_2.1-1
[28] ggplot2_3.5.1 iterators_1.0.14 scales_1.3.0
[31] MASS_7.3-61 MultiAssayExperiment_1.32.0 cli_3.6.3
[34] mzR_2.38.0 crayon_1.5.3 generics_0.1.3
[37] rstudioapi_0.17.1 httr_1.4.7 reshape2_1.4.4
[40] ncdf4_1.23 DBI_1.2.3 affy_1.82.0
[43] stringr_1.5.1 zlibbioc_1.50.0 parallel_4.4.1
[46] impute_1.78.0 AnnotationFilter_1.30.0 BiocManager_1.30.25
[49] XVector_0.44.0 vsn_3.72.0 vctrs_0.6.5
[52] Matrix_1.7-1 jsonlite_1.8.9 hms_1.1.3
[55] MALDIquant_1.22.3 clue_0.3-65 foreach_1.5.2
[58] limma_3.60.6 tidyr_1.3.1 snow_0.4-4
[61] affyio_1.74.0 glue_1.7.0 MSnbase_2.30.1
[64] codetools_0.2-20 QFeatures_1.16.0 Spectra_1.16.0
[67] stringi_1.8.4 gtable_0.3.6 UCSC.utils_1.2.0
[70] mzID_1.44.0 munsell_0.5.1 tibble_3.2.1
[73] pillar_1.9.0 MsFeatures_1.14.0 pcaMethods_1.96.0
[76] GenomeInfoDbData_1.2.13 R6_2.5.1 doParallel_1.0.17
[79] lattice_0.22-6 MetaboCoreUtils_1.14.0 Rcpp_1.0.13-1
[82] PSMatch_1.10.0 SparseArray_1.6.0 fs_1.6.5
[85] MsCoreUtils_1.16.1 pkgconfig_2.0.3

@jorainer
Copy link
Collaborator

jorainer commented Nov 7, 2024

Thanks for the detailed error report. Do you repeatedly get this error, i.e. if you restart R and repeat the commands, do you get the same error? It is very puzzling that the R session gets aborted. Are you running this code within RStudio? Have you tried running the code just in R (not within RStudio)? Maybe also ensuring that all packages are up-to-date might help (using BiocManager::install()). Also, maybe force re-installation of xcms using BiocManager::install("xcms", force = TRUE).

@jzhou19
Copy link
Author

jzhou19 commented Nov 7, 2024

Thank you for your reply.

Yes, I repeatedly get this error with new R sessions. I run the codes with RStudio.

I've now tried to update all packages, forced re-installation of xcms, and run the codes in R not RStudio but I still got the same errors. With register(SerialParam()), R just quit itself. This is not a part of the errors but I noticed that there was a message "value 5" printed before the progress bar for adjustRtime, not sure what that means.

@jzhou19
Copy link
Author

jzhou19 commented Nov 7, 2024

I had no luck with obiwarp but peak groups alignment (PeaksGroupsParam), as mentioned in #668, worked for me.

@jorainer
Copy link
Collaborator

jorainer commented Nov 8, 2024

hm. this is the first time I hear such issues causing R to quit. that should not happen and I suspect there might be some problem with the R installation, settings or the compilation of the C code of obiwarp in xcms. Maybe forcing compilation of the code in xcms might help (i.e. running BiocManager::install("xcms", force = TRUE, type = "source"))?

From own experience, obiwarp never really worked great on our data sets - so we are also using mostly the PeakGroupsParam.

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

2 participants