sneumann / xcms

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

Why the findChromPeaks function does not recognize smaller peak? #599

Open Violet99999 opened 2 years ago

Violet99999 commented 2 years ago

We are trying to use xcms to select peaks for analytes based on the pre-set retention time. In the plot below, the correct peak should be the lowest one at 4.15 minute; however, with our code, xcms always selects the highest peak. It seems that the 'findChromPeaks' function ignores the peak at 4.15 minutes for some reasons, even the intensity at 4.15 minute is not. We are wondering why the 'findChromPeaks' function doesn't recognize the smaller peak as a peak?

Here is our code to detect possible peaks for analytes: srmdata <- readSRMData(files=sample_file) # sample file is a mzml file exported directly from lcms machine mz <- srmdata[i] # mz is one single chromatogram from the srmdata (large Mchromatogram) matched_filter_param <- MatchedFilterParam(fwhm=0.001, snthresh=0) xchr1 <- findChromPeaks(mz, param=matched_filter_param)

xchr1 result: Object of class: XChromatogram length of object: 83 from file: 1 mz range: [NA, NA] #mz ratio is 225.1/44.2 rt range: [3.636217, 4.644417] MS level: 1 Identified chromatographic peaks (5): rt rtmin rtmax into maxo sn (2 more column(s)) 4.39253333333333 3.9692 4.64441666666667 12082.268825 284397 15.6017699285388 3.92975 3.90295 3.94316666666667 5.75098333333329 322 0.0176646375207526 3.83626666666667 3.77858333333333 3.84998333333333 6.11184000000001 214 0.0117398522653459 3.70573333333333 3.70573333333333 3.70573333333333 NaN 214 0.011739852265344 3.8766 3.8766 3.8766 NaN 107 0.00586992613267289

Set retention time as x and intensity as y {"x":4.094016666666667,"y":0.0}, {"x":4.106583333333333,"y":107.0}, {"x":4.118783333333333,"y":2466.0}, {"x":4.130983333333333,"y":10509.0}, {"x":4.1432,"y":19839.0}, {"x":4.1554,"y":22627.0}, This is the top point of the correct peak but 'findChromPeaks' does not recognize it as a peak (see xchr1 result) {"x":4.167883333333333,"y":16836.0}, {"x":4.18035,"y":8686.0}, {"x":4.192833333333334,"y":3968.0}, {"x":4.2053,"y":1501.0}, {"x":4.2168833333333339,"y":643.0}, {"x":4.228433333333333,"y":643.0}, {"x":4.24,"y":429.0}, {"x":4.251833333333333,"y":214.0},

analyte_peak_plot_22_0 18

Thank you!

jorainer commented 2 years ago

Is the fwhm you set for your data not much too low? I would try to use a larger value for that. Also, I was wondering if you wouldn't get maybe better results with CentWaveParam? You would obviously need to adapt the peakwidth parameter to something like peakwidth = c(0.01, 0.2) and also set snthresh to a very low value.

Also, what puzzles me a little is that you have the retention times in minutes and not in seconds - but I guess that's what's provided in the input mzML file.