lgatto / MSnbase

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

Smoothing of chromatogram in retention time domain: `combineSpectraMovingWindow` #521

Closed breidan closed 3 years ago

breidan commented 3 years ago

I am doing profiling of some biological extracts with LC-APCI-MS and my data is rather noisy. Running xcms::findChromPeaks,CentWaveParam over the unsmoothed data results in sometimes very irregular peak assignments. So I want to use combineSpectraMovingWindow to first smooth the chromatographic data first. I am aware of the issues with MSnExp and OnDiskMSnExp for further processing with xcms.

I am using MSnbase 2.12.0 (am currently limited to R3.6) and combineSpectraMovingWindow only accepts a mzd= argument. That leads to issues with either of the two extremes of the scan range, f.i. at the low end (m/z 100) a mzd=0.01 relates to 100 ppm accuracy while at the high end (m/z 1000) this would be 10 ppm. This is being measured on an Orbitrap and I have better than 5 ppm accuracy which I would like to maintain.

Now, meanMzInts accepts a ppm= argument. Anyway that can be issued to combineSpectraMovingWindow and if not, could that be implemented?

lgatto commented 3 years ago

I'll leave @jorainer reply to this one.

jorainer commented 3 years ago

Now that's a rather advanced question. Thanks for the thorough explanation @breidan . I will have a look at that and come back to you.

jorainer commented 3 years ago

I've added parameter ppm to combineSpectraMovingWindows - you can install the updated version for MSnbase 2.12.0 with: devtools::install_github("lgatto/MSnbase", ref = "RELEASE_3_10"). The fix is also in PR #522.

Note that you have to specify mzd = 0 if you only want to use the ppm - if you don't specify an mzd it gets automatically estimated on the data.

Please let me know if this works for you @breidan .

breidan commented 3 years ago

@jorainer, thanks for the very fast resolution of this. Seems to be working fine.