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

fillChromPeaks error #727

Closed JasonBason closed 3 months ago

JasonBason commented 3 months ago

Hello,

I am trying to gap fill peaks for an XcmsExperiment object but end up getting an error. I don't have much coding experience, and this is the first issue I've raised on github, so appologies for my formatting! I was following along with several vignettes with my own data, but cannot seem to get through this next step.

Here is the code that raises the error:

xdata <- fillChromPeaks(xset_g_r_g,
                        param = ChromPeakAreaParam(),
                        BPPARAM = SerialParam())

xset_g_r_g is a peak-picked dataset that has been grouped and rt corrected using PeakGroupsParams. Here are its details:

Object of class XcmsExperiment 
 Spectra: MS1 (116921) 
 Experiment data: 120 sample(s)
 Sample data links:
  - spectra: 120 sample(s) to 116921 element(s).
 xcms results:
  - chromatographic peaks: 394817 in MS level(s): 1 
  - adjusted retention times: mean absolute difference 0.449 seconds
  - correspondence results: 11444 features in MS level(s): 1 

The error I get is: Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'split': error writing to connection

Here is the traceback: 32: h(simpleError(msg, call)) 31: .handleSimpleError(function (cond) .Internal(C_tryCatchHelper(addr, 1L, cond)), "error writing to connection", base::quote(serialize(data, node$con))) 30: serialize(data, node$con) 29: sendData.SOCKnode(backend[[node]], value) 28: parallel:::sendData(backend[[node]], value) 27: .send_to(backend, node, value) 26: .send_to(backend, node, value) 25: .send_all(manager$backend, value) 24: .send_all(manager$backend, value) 23: .manager_cleanup(manager) 22: .manager_cleanup(manager) 21: .bploop_impl(ITER = ITER, FUN = FUN, ARGS = ARGS, BPPARAM = BPPARAM, BPOPTIONS = BPOPTIONS, BPREDO = BPREDO, reducer = reducer, progress.length = length(redo_index)) 20: bploop.lapply(manager, BPPARAM = BPPARAM, BPOPTIONS = BPOPTIONS, ...) 19: bploop(manager, BPPARAM = BPPARAM, BPOPTIONS = BPOPTIONS, ...) 18: .bpinit(manager = manager, X = X, FUN = FUN, ARGS = ARGS, BPPARAM = BPPARAM, BPOPTIONS = BPOPTIONS, BPREDO = BPREDO) 17: bplapply(split(object@backend, f), .local, queue = pqueue, svars = spectraVariables, BPPARAM = BPPARAM) 16: bplapply(split(object@backend, f), .local, queue = pqueue, svars = spectraVariables, BPPARAM = BPPARAM) 15: .peaksapply(object, f = f, columns = columns, BPPARAM = BPPARAM, ...) 14: SimpleList(.peaksapply(object, f = f, columns = columns, BPPARAM = BPPARAM, ...)) 13: .local(object, ...) 12: peaksData(filterMsLevel(spectra(x), msLevel)) 11: peaksData(filterMsLevel(spectra(x), msLevel)) 10: split(peaksData(filterMsLevel(spectra(x), msLevel)), f) 9: .getDotsForMapply(...) 8: bpmapply(split(peaksData(filterMsLevel(spectra(x), msLevel)), f), split(rt, f), pal, as.integer(names(pal)), FUN = intFun, MoreArgs = list(mzCenterFun = mzCenterFun, cn = cn, param = param), SIMPLIFY = FALSE, USE.NAMES = FALSE, BPPARAM = BPPARAM) 7: bpmapply(split(peaksData(filterMsLevel(spectra(x), msLevel)), f), split(rt, f), pal, as.integer(names(pal)), FUN = intFun, MoreArgs = list(mzCenterFun = mzCenterFun, cn = cn, param = param), SIMPLIFY = FALSE, USE.NAMES = FALSE, BPPARAM = BPPARAM) 6: .xmse_integrate_chrom_peaks(.subset_xcms_experiment(object, i = z, keepAdjustedRtime = TRUE, ignoreHistory = TRUE), pal = pal[z], intFun = fill_fun, mzCenterFun = mzf, param = prm, BPPARAM = BPPARAM) 5: FUN(X[[i]], ...) 4: lapply(chunks, function(z, ...) { pb$tick() .xmse_integrate_chrom_peaks(.subset_xcms_experiment(object, i = z, keepAdjustedRtime = TRUE, ignoreHistory = TRUE), pal = pal[z], intFun = fill_fun, mzCenterFun = mzf, param = prm, BPPARAM = BPPARAM) }) 3: .local(object, param, ...) 2: fillChromPeaks(xset_g_r_g, param = ChromPeakAreaParam(), BPPARAM = SerialParam()) 1: fillChromPeaks(xset_g_r_g, param = ChromPeakAreaParam(), BPPARAM = SerialParam())

Any help would be great! Thank you

jorainer commented 3 months ago

Hey Jason, great first issue! a lot of information shared, which makes it much easier to understand what's going on. what would also be great is to post the output of your sessionInfo() to get some information on the operating system you use and the package versions.

the error is very strange. All points towards a parallel processing problem - but since you used BPPARAM = SerialParam() parallel processing should have been disabled. Can you please try to set also register(SerialParam()) before the fillChromPeaks call? And can you also show the output of calling spectra(xset_g_r_g) - just to understand what backend your data is using?

JasonBason commented 3 months ago

Hello!

After posting this issue, I updated xcms from 4.1.1 to 4.1.9 and R from 4.3.1 to 4.3.3. This included updating through github the packages Spectra, MsCoreUtils, and MsExperiment (there might have been some other packages as well). Unfortunately, I didn't record the sessioninfo from yesterday.

However, after updating, it looks like the fillChromPeaks function is running!

Thanks again for getting back so quickly!