sneumann / mzR

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

Cannot access header for MRM data #224

Open joerg-b opened 4 years ago

joerg-b commented 4 years ago

I'm trying to access the header or runInfo data for a MRM run, unfortunately without success.

This is the mzML file that I have generated from the original .d file using msconvert: 00038875IgE_1_43_CC.mzML.zip

this is my R code:

mz <- openMSfile('00038875IgE_1_43_CC.mzML', backend = "pwiz")
runInfo(mz)
header(mz)

For both runInfo(mz) and header(mz) I get this error message:

Error in object@backend$getAllScanHeaderInfo() : 
  upper value must be greater than lower value

Obviously there are no scans but only chromatograms in this data set. Does this cause a problem? I can extract the chromatograms without a problem from this file.

sneumann commented 4 years ago

I can confirm the issue here. Frankly, I couldn't even locate the code line where the error is thrown.

> runInfo(mz)
Error in object@backend$getAllScanHeaderInfo() :   upper value must be greater than lower value
> traceback()
8: stop(structure(list(message = "upper value must be greater than lower value", 
       call = object@backend$getAllScanHeaderInfo(), cppstack = NULL), class = c("std::range_error", 
   "C++Error", "error", "condition")))
7: .External(structure(list(name = "CppMethod__invoke_notvoid", 
       address = <pointer: 0x561fd59c1bd0>, dll = structure(list(
           name = "Rcpp", path = "/usr/local/lib/R/site-library/Rcpp/libs/Rcpp.so", 
           dynamicLookup = TRUE, handle = <pointer: 0x561fd6976bb0>, 
           info = <pointer: 0x561fd4491640>), class = "DLLInfo"), 
       numParameters = -1L), class = c("ExternalRoutine", "NativeSymbolInfo"
   )), <pointer: 0x561fd90d1c10>, <pointer: 0x561fd6a651e0>, .pointer)
6: object@backend$getAllScanHeaderInfo()
5: .local(object, ...)
3: header(object)
1: runInfo(mz)
sneumann commented 4 years ago

Ok, indeed runInfo() tries to go through all spectra https://github.com/sneumann/mzR/blob/b4a2f2dad2cc3ae880ab1e8676a6350271d32330/src/RcppPwiz.cpp#L357 which are, as you said, all empty. Fix would be an if around it and returning at least something empty. Yours, Steffen