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

plotChromPeakDensity() - no peak #652

Open linlennypinawa opened 1 year ago

linlennypinawa commented 1 year ago

A XChromatograms object was generated by executing findChromPeaks() on a MChromatogram object. I used the following CentWave settings.

CentWaveParam(ppm=20,
                     peakwidth=c(.05, 2), 
                     snthresh=2, 
                     integrate=1, 
                     noise=500, 
                     prefilter=c(2,500), 
                     mzdiff=-0.01, 
                     fitgauss=TRUE, 
                     mzCenterFun="apex")

I ploted it, no problem. 189_pk

However, I got no peak when executing plotChromPeakDensity(). The codes are as follows:

pdp <- PeakDensityParam(sampleGroups = myfile$sample_group,
                        binSize = 0.1,
                        bw =.5,
                        minSamples = 3,
                        minFraction = 1,
                        maxFeatures = 20)

plotChromPeakDensity(myfile, col = sample_colors, param = pdp,
                     peakBg = sample_colors,
                     peakCol = sample_colors,
                     peakPch = 16)

I wonder if there were not enough scanning points.

What does 'no peak' mean?

jorainer commented 1 year ago

From the plot above it looks like no chromatographic peak was identified with your CentWaveParam settings in that one EIC. Maybe you need to adapt your settings, e.g. by decreasing the value for snthresh - or maybe even increase/widen the peakwidth?

arpita-007 commented 1 year ago

Hi, I was doing the preprocessing and got this error. I processed my data for positive mode without any obstruction but the following error I am getting with the same script for when I am running negative mode.

pdp_GRN <- PeakDensityParam(sampleGroups = aligned_GRN$sample_group, minFraction = 0.81, bw = 0.879999999999999, minSamples = 1) grouped_GRN <- groupChromPeaks(aligned_GRN, param = pdp_GRN) Error: The 'sampleGroups' value in the provided 'param' class does not match the number of available files/samples!

jorainer commented 1 year ago

Can it be that you have a different number of samples for positive and negative mode? What are the values in aligned_GRN$sample_group?

arpita-007 commented 1 year ago

Hi @jorainer, actually the number of samples was the same in both modes, but one sample it excluded as it did not have any spectrum. That's why it was showing this error.

Thank you!

jorainer commented 1 year ago

Thanks for the update - is this now solved?

arpita-007 commented 1 year ago

Yes, it is solved. But I have other queries.

  1. Can we subtract the blank from the sample spectra in XCMS?
  2. Can we get TIC values for individual spectra?
  3. Can we do normalization in XCMS (specifically TIC)?

Thank you

jorainer commented 1 year ago

Can we subtract the blank from the sample spectra in XCMS?

currently not.

Can we get TIC values for individual spectra?

you can get the TIC using the tic function. If you want that for individual spectra you would need to subset the object before.

Can we do normalization in XCMS (specifically TIC)?

there is no dedicated normalization function in xcms. After calling quantify on a xcms result object you get however a standard SummarizedExperiment object with the feature abundances. you can then apply any normalization strategy/function to this data (e.g. simple ones like median scaling or also lowess normalization etc).

arpita-007 commented 1 year ago

Thanks for explaining. Can you please guide me on solving this error-

Error in adjustRtimeSubset(rtraw, adjRt, subset = subs, method = subsetAdjust(param)) : Lengths of 'rtraw' and 'rtadj' have to match.

I have no idea why is it showing like this as my file no.is same. It is coming like this-

aligned_HCP <- adjustRtime(peakpicking_HCP, param = rtparam_HCP) Sample number 16 used as center sample. Aligning A2_BLANK_20220726165521.mzML against C111_31_2.mzML ... OK Aligning A3_BLANK_20220726172012.mzML against C111_31_2.mzML ... OK Aligning A5_BLANK_1.mzML against C111_31_2.mzML ... OK Aligning A6_QC1.mzML against C111_31_2.mzML ... OK Aligning B36_12_1.mzML against C111_31_2.mzML ... OK Aligning B37_12_2.mzML against C111_31_2.mzML ... OK Aligning B39_13_1.mzML against C111_31_2.mzML ... OK Aligning B4_2_2.mzML against C111_31_2.mzML ... OK Aligning B72_BLANK_1_20220802175835.mzML against C111_31_2.mzML ... OK Aligning B73_QC1_20220802182327.mzML against C111_31_2.mzML ... OK Aligning B75_BLANK_2_20220802191317.mzML against C111_31_2.mzML ... OK Aligning B76_21_1_20220802193808.mzML against C111_31_2.mzML ... OK Aligning C107_QC1_20220804121141.mzML against C111_31_2.mzML ... OK Aligning C108_QC1_20220804123632.mzML against C111_31_2.mzML ... OK Aligning C110_31_1.mzML against C111_31_2.mzML ... OK Aligning C145_41_2.mzML against C111_31_2.mzML ... OK Aligning C146_BLANK_5.mzML against C111_31_2.mzML ... OK Aligning C148_42_2.mzML against C111_31_2.mzML ... OK Aligning C149_BLANK_6.mzML against C111_31_2.mzML ... OK Aligning C182_51_2.mzML against C111_31_2.mzML ... OK Aligning C183_BLANK_18.mzML against C111_31_2.mzML ... OK Aligning C185_52_2.mzML against C111_31_2.mzML ... OK Aligning C186_BLANK_19.mzML against C111_31_2.mzML ... OK Aligning D218_62_2.mzML against C111_31_2.mzML ... OK Aligning D219_BLANK_32.mzML against C111_31_2.mzML ... OK Aligning D221_63_2.mzML against C111_31_2.mzML ... OK Aligning D222_BLANK_33.mzML against C111_31_2.mzML ... OK Error in adjustRtimeSubset(rtraw, adjRt, subset = subs, method = subsetAdjust(param)) : Lengths of 'rtraw' and 'rtadj' have to match.

jorainer commented 1 year ago

Can you please 1) show how you created rtparam_HCP (to understand what algorithm you are using and which settings) and 2) paste the output of sessionInfo() (some problems issues were fixed in newer versions of xcms, so it could be that you are using an outdated version).