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 27 forks source link

Ionization polarity not right (source file from agilent) #46

Closed stanstrup closed 7 years ago

stanstrup commented 8 years ago

Not sure if this belongs with XCMS or mzR but seems mzR doesn't get it right.

I have an mzML file (sample: https://drive.google.com/file/d/0BzbMKsT1SFGiUzVQNzhSM3VjRXc/view?usp=sharing) converted from agilents .d format with proteowizard. I am trying to determine the ionisation polarity.

If I do:

mz <- openMSfile(file)
runInfo(mz)
header(mz)$polarity

I just get -1's. But this file is positive mode. XCMS reports unknown.

In the mzML file there is also a line for each spectrum that indicates as much:

<cvParam cvRef="MS" accession="MS:1000130" name="positive scan" value=""/>
wilsontom commented 8 years ago

I am also observing this behaviour after converting Thermo .raw files to .mzML via proteowizard

Tom

sneumann commented 7 years ago

Hi @stanstrup , if you are happy with mzR-2.9.8, please close this one as well.

sneumann commented 7 years ago

Note that the fix requires openMSfile(file, backend="pwiz"), which has been default in xcms for several months, but default in mzR is still backend="ramp", until we close #84

stanstrup commented 7 years ago

I'd like to check this but I am unable to build mzR from source on windows. I get: rnetCDF.h:1:20: fatal error: netcdf.h: No such file or directory

sneumann commented 7 years ago

Would be fixed by #11 ... For now, follow: https://github.com/sneumann/mzR/issues/50#issuecomment-249516337 Or wait until 0.9.8 is on the build machines tonight or tomorrow.

stanstrup commented 7 years ago

Thanks! Got that working.

But both backends reports 0s and XCMS reports "negative". :(

sneumann commented 7 years ago

Works over here:

> library(mzR)
Loading required package: Rcpp
> ms <- openMSfile("EluentB_IPA3_Boiled.mzML", backend="pwiz")
> header(ms)$polarity
  [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[112] 1 1 1 1

Will also check xcms next.

stanstrup commented 7 years ago

Hmm. that is mighty strange. I double-checked the github SHA and I cannot get your result. Any idea how that is possible?

sneumann commented 7 years ago

So, in mzR neg=0, pos=1 and unknown=-1 works here for backend=pwiz, but broken for backend=Ramp. xcms currently using Ramp as default, so getting it wrong.

stanstrup commented 7 years ago

Seems my work computer is behaving very strangely. At home I have confirmed that it now works correctly.

jorainer commented 7 years ago

I was just wondering - wouldn't it be more intuitive to have neg = -1, pos = 1 and unknown = NA?

sneumann commented 7 years ago

Indeed more intuitive, but that's what Ramp has given us for years. Consistency wins over intuition. Good that xcms uses the factor now!

stanstrup commented 7 years ago

FYI: I fixed my trouble by manually deleting mzR and recompiling. Seems for some reason old things were silently left behind.