sneumann / xcms

This is the git repository matching the Bioconductor package xcms: LC/MS and GC/MS Data Analysis
Other
177 stars 81 forks source link

Filter out one mz #649

Closed linlennypinawa closed 1 year ago

linlennypinawa commented 1 year ago

I have an idea of cleaning up mz data by removing 'weeds'. They could be interferences. I read methods-XCMSnExp.R file. It seems to me the default filterMz() is range(mz).

Is it by any chance I could use filter() in R with between(), and logic functions, like | ,&, or !=?

The work around solution would be: extract spectrum data, manipulate mz data, and put back to MSnExp. Is it correct?

jorainer commented 1 year ago

No, xcms does not support between or filter and logic operations for filters. The only available filter for now is filterMz as you already found and specifying an upper and lower m/z keeping all peaks with m/z within these.

The next large update of xcms will use the Spectra package for MS data representation. So, in future there might be better and more powerful filters available.

jorainer commented 1 year ago

Regarding your workaround - you can't put m/z data back into an OnDiskMSnExp. you could however filter your data (using filterMz) and then export it to an mzML file (using writeMsData).

linlennypinawa commented 1 year ago

Thank you Johannes. It is not as clear as mud. Appreciate that!