Closed SONGKai-PKU closed 6 months ago
MSnbase relies on mzR to parse raw data. Could you try they following and open an issue there:
library(mzR)
x <- openMSfile(list.files()[1]) ## assuming that list.files returns the correct file(s)
Have you tried converting to mzML?
Thanks for your reply. It did work in mzR. However, when converted into mzML, certain errors still occurs.
setwd("F:/TDGCMS/Mobile_source/data_processing/comprehensive_pixel/Image_CDF_XCMS/cooking/CDF/")
CDF_name <- list.files()[1] CDF_temp <- openMSfile(CDF_name)
pks <- spectra(CDF_temp)
hdr <- header(CDF_temp)
out_file_name <- CDF_name %>% stringr::word(sep = fixed(".cdf"))
setwd("F:/TDGCMS/Mobile_source/data_processing/comprehensive_pixel/Image_CDF_XCMS/cooking/mzXL/") writeMSData(object = pks, file = out_file_name, header = hdr)
setwd("F:/TDGCMS/Mobile_source/data_processing/comprehensive_pixel/Image_CDF_XCMS/cooking/mzXL/") cooking_raw_data <- readMSData(files = list.files())
Error in readInMemMSData(files, pdata = pdata, msLevel. = msLevel., verbose = verbose, : No MS(n>1) spectra in fileF:\TDGCMS\Mobile_source\data_processing\comprehensive_pixel\Image_CDF_XCMS\cooking\mzXL\cooking_gas_01_Run01_Img01
Please refer to the CDF files as follows, https://drive.google.com/drive/folders/1fKWLnNJHbnQipQmPY6c7-OmaOEju69hy?usp=sharing
Kai~
Indeed, the error comes from the mzR::instrumentInfo
function that is called by readMSData
, seems the "instrument_name"
field is missing in the CDF file. This would need to be fixed in mzR
- but maybe it would even work with mzML.
Can you try to read the mzML file using the same settings (i.e. with mode = "onDisk"
)?
Hi @lgatto
Just an info this cdf to mzML conversion trick worked for my GCMS Leco files where intrument_name variable is missing in the cdf but the size of the mzML file is 1.7 time bigger !
would be cool for GCMS users to have an option in MSnbase that allows cdffiles without these variables (the branch you made for me some years ago may help https://github.com/lgatto/MSnbase/tree/yguitton). I wasn't able to adapt it to the new R and xcms
Best Yann
Dear @lgatto
I converted GC×GC chromatograms into netCDF form, which could be potentially read by the MSnbase. However, when trying to read this file, several errors occurred. Could you please help me?
Best regards, Kai