xcms icon indicating copy to clipboard operation
xcms copied to clipboard

Error in writeMSData

Open lshyun0415 opened this issue 2 years ago • 1 comments

Hello, I'm trying to export my preprocessed XCMSnExp object (neighboring peak merged, RT aligned, feature grouped, gap filled) as individual mzml files by sample, but it's been giving a subscript out of bounds error. I wasn't sure where the problem was coming from since I used a character vector of the sample names as input for the file parameter. I tried subsetting the XCMSnExp object by sample and saving it individually, but it still gave me the same error message.

Also, is there a way to save the entire XCMSnExp object as an mgf or msp file?

I attached my code and the error message below. Any comment would help. Thank you so much!

**XCMSnExp object show(xchr_ftgr) MSn experiment data ("XCMSnExp") Object size in memory: 19.49 Mb

      • Spectra data - - - MS level(s): 1 2 Number of spectra: 58188 MSn retention times: -1:48 - 16:04 minutes
      • Processing information - - - Data loaded [Wed Sep 13 16:21:20 2023] MSnbase version: 2.26.0
      • Meta data - - - phenoData rowNames: 1 2 ... 34 (34 total) varLabels: sample_name sample_group varMetadata: labelDescription Loaded from: [1] 230810_NO68_M7_C_1-1_P.mzML... [34] 230810_NO101_M7_D_8-4_8-5_P.mzML Use 'fileNames(.)' to see all files. protocolData: none featureData featureNames: F01.S0001 F01.S0002 ... F34.S1630 (58188 total) fvarLabels: fileIdx spIdx ... spectrum (35 total) fvarMetadata: labelDescription experimentData: use 'experimentData(object)'
      • xcms preprocessing - - - Chromatographic peak detection: method: centWave 901440 peaks identified in 34 samples. On average 26513 chromatographic peaks per sample. Alignment/retention time adjustment: method: obiwarp Correspondence: method: chromatographic peak density 8786 features identified. Median mz range of features: 0.0032953 Median rt range of features: 29.115 106999 filled peaks (on average 3147.029 per sample).

**Export code xcms::writeMSData(object = xchr_ftgr, file = basename(phenoData(xchr_filled)$sample_name)[1], outformat = "mzml", copy = T)

**Error message Error in (function (cond) : error in evaluating the argument 'args' in selecting a method for function 'do.call': subscript out of bounds

lshyun0415 avatar Sep 14 '23 03:09 lshyun0415

Hi, thanks for reporting. Is there a way you can reproduce this with the faahKO data ? If so, we could include this as test case and fix what's broken. Or is that specific to your data set ? Can you give us some debugging information, e.g. versions (xcms and MSnbase) and either use the debugger to check what's wrong, or if you are not a seasoned R hacker (yet), then after the error occurs the output of the traceback() command ?

Yours, Steffeb

sneumann avatar Sep 18 '23 08:09 sneumann