lgatto / MSnbase

Base Classes and Functions for Mass Spectrometry and Proteomics
http://lgatto.github.io/MSnbase/
123 stars 50 forks source link

Read Bruker Tims data MSnbase error #590

Closed yguitton closed 1 year ago

yguitton commented 1 year ago

Hi @lgatto, Hi @jorainer I've just received mzXML and mzML data converted from Bruker Tims Tof Pro .d files and the error is

mem <- readMSData(filemzml, mode = "inMemory") Error: Can not open file C:\Users\ygu\Documents\blank autoMSMS_3_1_2558.mzML! Original error was: Error in pwizModule$open(filename): [MSDataFile::readFile()] Unsupported file format.

I found in old post that the issue can be linked to old version of mzR ou MSnbase but think that I'm up to date with packages

Maybe not doing the right things, any help appreciated. Best Yann

My session info '[1] xcms_3.20.0 MSnbase_2.24.2 ProtGenerics_1.30.0 S4Vectors_0.36.1
[5] mzR_2.32.0 Rcpp_1.0.9 Biobase_2.58.0 BiocGenerics_0.44.0 [9] BiocParallel_1.32.5'

jorainer commented 1 year ago

Hi Yann! Your error comes indeed from mzR, but you have the current stable mzR version - and AFAIK we did not add/change anything in the current devel version (which would be 2.33.0). I guess the problem is the proteowizard version within mzR - because the [MSDataFile::readFile()] looks like a error message from the proteowizard C++ code.

Two options:

jsaintvanne commented 1 year ago

Hi @lgatto, I work with @yguitton and I would try to use your spectra branch of xcms to try it and test it on a file but don't know how to really use it.... I'm trying to devtools::install_github("https://github.com/sneumann/xcms.git", ref = "spectra") but finish with an error. Should I clone the repo and then use the branch ? In this case i'm not sure to know how to be sure to use spectra branch and not the main default one ? Can you help me a little describing me maybe the function to use (if it is just a function) because in your PR you changed a loooooot of files and don't really know what to use to test on Bruckers .d files Thanks for your help !

lgatto commented 1 year ago

I think the latest version of xcms now uses Spectra. @jorainer will be able to help here.

jorainer commented 1 year ago

Hi @jsaintvanne ,

to install the upcoming xcms version (it's not yet merged - and after some discussion Steffen and I decided to wait for the next BioC release) you will also need some other (updated) packages. I suggest to not do this in a production system, but on a development setup.

devtools::install_github("RforMassSpectrometry/MsCoreUtils")
devtools::install_github("RforMassSpectrometry/Spectra")
devtools::install_github("RforMassSpectrometry/MsExperiment")
devtools::install_github("sneumann/xcms", ref = "spectra")

and you will also need the backend that supports the TimsTOF files: MsBackendTimsTof; ideally also check that page for additional requirements (needs some libraries from the manufacturer to read the data).

devtools::install_github("RforMassSpectrometry/MsBackendTimsTof")

I suggest to test it by reading a single file (assuming parameter fl is the path/filename of one .d file you have).

library(xcms)
library(MsExperiment)
library(MsBackendTimsTof)

mse <- readMsExperiment(fl, source = MsBackendTimsTof())

Next we load all data into memory (that's not ideal, but there is still some required functionality missing in the current MsBackendTimsTof). This should in future no longer be needed!

mse@spectra <- setBackend(mse@spectra, MsBackendMemory())

you could then run xcms preprocessing on that data, the same way you would do it if you used MSnbase for data import.

xmse <- findChromPeaks(mse, param = CentWaveParam())

There is a lot of things we still need improve in the MsBackendTimsTof backend/package ...

Let me know how that works or if you have any problems.

jsaintvanne commented 1 year ago

Hi @jorainer Thanks a lot for all these clear explanations !

My side, I tried with one file in R directly with the MsBackendTimsTof package (I think if remember well) with this function :

sps <- Spectra(my_path_folder, source = MsBackendTimsTof()) 

Then I used the write_ms_data_mzR function to make a mzML file and to finish I readMSData it ! It looks that works but I have at the final function 2 errors but a result also... Don't know why yet ! And now, I will try to test it in Galaxy from the mzML file to see it if it works like this and if we can use it in Galaxy like the other files.

Keep you inform and thanks again !