sneumann / mzR

This is the git repository matching the Bioconductor package mzR: parser for netCDF, mzXML, mzData and mzML files (mass spectrometry data)
40 stars 26 forks source link

unable to open netCDF file #289

Closed jqb3644 closed 4 months ago

jqb3644 commented 5 months ago

Hi when I try to use mzR to open a netCDF file I get the following error

Error in openMSfile("Desktop/01.CDF") Unable to open netCDF file.

I have tried specifying the backend as netCDF but get the same error

lgatto commented 5 months ago

I think the error you see is the result of the mzR:::netCDFIsFile() function trying to unsuccessfully open/test your file. Are you sure about that file?

sneumann commented 5 months ago

Who/what wrote 01.CDF ? mzR tests presence of a few variables in the file, and if tests fail it can't open the file. Yours, Steffen

jqb3644 commented 5 months ago

The cdf file was written by waters databridge of an mse experiment. It was opened and read successfully by the readMSexperiment function of xcms

Which variables is mzR looking for in a netCDF file?

lgatto commented 5 months ago

The MsExperiment::readMsExperiment() function (it's not from xcms) uses the Spectra::Spectra() constructor, that makes us the mzR under the hood, so I very much doubt one works and not the other. Could you double check.

jqb3644 commented 5 months ago

thanks for your quick responses. I've attached a screen shot of the error message I get when trying to load the same CDF file two different ways.

it works with the readMSexperiment function but not the xcmsSet or openMSfile function

errormessage

lgatto commented 5 months ago

Could you share that test.CDF file.

jqb3644 commented 5 months ago

unfortunately lockmass.zip I can't share the original file but I can share the lockmass CDF which gives me the same error

Thanks for your help

lgatto commented 5 months ago

No problem on my side, I can open the file with mzR::openMSfile() and Spectra::Spectra() (used by readMsExperiment()).

Make sure you have an up-to-date installation.

sneumann commented 5 months ago

Hi, so xcms technically works fine:

xr <- xcmsRaw("lockmass.CDF")
# Create profile matrix with method 'bin' and step 1 ... OK
xr
#An "xcmsRaw" object with 61 mass spectra
#
#Time range: 1.9-3560.8 seconds (0-59.3 minutes)
#Mass range: 49.9416-2000.3773 m/z
#Intensity range: 1.00079-188980 
#Memory usage: 8.98 MB

but 61 mass spectra in 60 minutes is a bit poor.

I also have no problem opening in mzR:

ms <- openMSfile("lockmass.CDF")
dim(header(ms))
#[1] 61 31

=> What exactly is failing for you ? Yours, Steffen