sneumann / mzR-playground

Playground area for the mzR package. The main code repository is now at https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/mzR/
http://bioconductor.org/packages/devel/bioc/html/mzR.html
5 stars 2 forks source link

Bad header in mzData causes segfault #6

Closed lgatto closed 13 years ago

lgatto commented 13 years ago

Test data is experiment 12011 downloaded from PRIDE.

library(mzR) Loading required package: Rcpp mzd <- openMSfile("PRIDE_Exp_mzData_Ac_12011.xml",format="mzData") 3: >PRIDE_Exp_mzData_Ac_12011.xml mzd Mass Spectrometry file handle. Filename: PRIDE_Exp_mzData_Ac_12011.xml number scans: 26951 lowMZ: 1.159921e+214 highMZ: 6.47969e+170 startMZ: 1.159921e+214 endMZ: 6.47969e+170 dStartTime: 1.599013e-17 dEndTime: 3.374874e-310 hd <- header(mzd) hd[1:5,1:3] seqNum acquisitionNum msLevel 1 1 1 2 2 -1 -1 0 3 3 3 2 4 -1 -1 0 5 5 5 2 hd <- header(mzd,1) hd <- header(mzd,3) hd <- header(mzd,2)

* caught segfault * address 0x8, cause 'memory not mapped'

Traceback: 1: .External(list(name = "CppMethod__invoke_notvoid", address = <pointer: 0x38\ 9ba50>, dll = list(name = "Rcpp", path = "/usr/local/lib64/R/library/Rcpp/l\ ibs/Rcpp.so", dynamicLookup = TRUE, handle = <pointer: 0x2bce2f0>, \ info = <pointer: 0x7f1f28cf6300>), numParameters = -1L), <pointer: 0x35\ 02c90>, <pointer: 0x2db93e0>, .pointer, ...) 2: object@ramp$getScanHeaderInfo(scans) 3: .local(object, scans, ...) 4: header(mzd, 2) 5: header(mzd, 2)

Header is suspicious. There is of course no msLevel="-1" in the original file, rather msLevels 1 and 2. peaks(mzd,2) returns empty dataframe.

sneumann commented 13 years ago

Hi,

The file has only the odd spectrum ids, so RAMP "fills-in" the even ids, with no or illegal data.

... ake sure to add "declaredOnly = TRUE", I'll set that to be the default. library(mzR) mzd <- openMSfile("PRIDE_Exp_mzData_Ac_12011.xml", format="mzData", declaredOnly = TRUE) hd <- header(mzd,2)
sneumann commented 13 years ago

Ah, XML in github comments get lost in above comment :-(

I committed a fix, which makes declaredOnly = TRUE the default behavior.

We still need to 1) remove declaredOnly altogether or b) fix access to empty scans in header().

Yours, Steffen