sneumann / xcms

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

MRM Data quantification #552

Closed Dolphineee closed 3 years ago

Dolphineee commented 3 years ago

Hi,

I have used readSRMData() function to read the MRM data from mzML files.

mrmdata MChromatograms with 432 rows and 2 columns 1 2

[1,] length: 10 length: 10 [2,] length: 10 length: 10 ... ... ... [431,] length: 10 length: 10 [432,] length: 10 length: 10 phenoData with 1 variables featureData with 10 variables

I would like to ask whether there is an algorithm to quantify MRM data (calculate peak area for each peaks) with the MChromatograms object.

Thanks for your time!

jorainer commented 3 years ago

Actually yes. It should be possible to run findChromPeaks also on the MChromatograms objects from MSnbase. All settings and everything is the same as you would run the peak detection on regular LC-MS data (represented as an OnDiskMSnExp).

Dolphineee commented 3 years ago

Hi Jorainer,

That's really helpful, thanks for your quick respond!

Dolphineee commented 3 years ago

Hi Jorainer,

I have a MChromatograms object (a small subset from large MChromatograms object) with 2 Chromatogram. The retention time of the first Chromatogram is : 0.4834333 0.6534833 0.7619833 0.8704666 0.9789500 1.0874333 1.1959333 1.3044167 1.4129000 1.5214000; the intensity of the first Chromatogram is: 0 600 1100 1200 100 100 0 0 0 0 The retention time and intensity of the second Chromatogram is similar with the first one.

I first wrote a CentWaveParam as follows: Parameters: ppm: 1000 peakwidth: 0, 1000 snthresh: 5 prefilter: 1, 10 mzCenterFun: wMean integrate: 2 mzdiff: -0.001 fitgauss: FALSE noise: 10 verboseColumns: FALSE roiList length: 0 firstBaselineCheck TRUE roiScales length: 0

Then I tried to find the peak with findChromPeaks:

res <- findChromPeaks(ms1, param=cwp)

However, there was no peak found. I thought I have set the CentWaveParam to a wide range, but I don't know why the peak didn't show up.

res XChromatograms with 1 row and 2 columns 1 2

[1,] peaks: 0 peaks: 0 phenoData with 1 variables featureData with 10 variables - - - xcms preprocessing - - -
jorainer commented 3 years ago

I would suggest to lower the snthresh - maybe even to 0.5 or similar. Noise estimation in MRM data is tricky, because there is not enough "background" signal to estimate it properlu. Note also that the ppm is ignored for peak detection on MChromatograms (as there is no scattering on m/z values). I would also suggest to set the peakwidth to something more reasonable.

Dolphineee commented 3 years ago

Thanks for the information. I have set peakwidth to c(30,60) (also tried with a bit wider and narrower peakwidth settings) and lower the snthresh to 0.5, even tried with 0.1, but I am still unable to find the peak.

jorainer commented 3 years ago

can you eventually plot one of the peaks (e.g. using plot(ms1[1, ])? just to know how they look like.

Dolphineee commented 3 years ago

sure, the plotted peaks are attached 2 chromatogram peaks from a Mchromatograms object.docx

jorainer commented 3 years ago

Uh, the first one will clearly fail to be identified as it it a single intensity above 0. CentWave needs some more datapoints for peak detection. The second one is also pretty sparse. Also, the peaks are pretty narrow (the retention time is shown in seconds!). Thus I would suggest you try with peakwidth = c(0.1, 1) or with peakwidth = c(0.1, 2) (don't know how whether you also expect broader peaks). But for peaks that are that narrow it will be tricky to identify peaks (because originally the algorithm was not designed to identify sub-second peaks - if I remember there is somewhere a rounding happening inside). But in newer versions of xcms there is the parameter extendLengthMSW in CentWaveParam that can help. I would suggest to set that parameter to TRUE (i.e. CentWaveParam(...other settings..., extendLengthMSW = TRUE). Do you have this option also or does extendLengthMSW = TRUE cause an error for you? If so, could you please provide the output of sessionInfo() so that I can check the package versions?

Dolphineee commented 3 years ago

I have tried with peakwidth=c(0.1,1) and extendLengthMSW=FALSE using the findChromPeaks function (it returned an XChromatogrmas object with 432 elements), I checked it with chromPeaks(), no peak was detected. Then I tried with the same settings with extendLengthMSW=TRUE, 77 rows showed up. There was no error with extendLengthMSW setting.

Thanks for your help, I have learned a lot!

jorainer commented 3 years ago

Me too ;) I completely forgot about that parameter - big thanks to @wkumler for implementing that!

I'm no closing the issue - feel free to re-open if needed.