xcms icon indicating copy to clipboard operation
xcms copied to clipboard

Alignment of experiment containing BLANKS AND QC

Open Adafede opened this issue 4 years ago • 10 comments

Hi,

I am having trouble to align my experiment containing blk,qc1, sample...,qc2, sample...,qc3, sample...,...qc6,blk.

initial data: Rplot

When aligning without subset,

dda_data <- adjustRtime(object = dda_data, param = ObiwarpParam(binSize = 0.6))

works very well on samples

Rplot01

although looks nasty for blanks

Rplot03

But when using subsets...

pdp_subs <- PeakDensityParam(
  sampleGroups = dda_data$sample_group,
  binSize = 0.6,
  minFraction = 0.8
)

dda_data <- groupChromPeaks(object = dda_data, param = pdp_subs)

pgp_subs <- PeakGroupsParam(
  minFraction = 0.8,
  subset = which(dda_data$sample_group == "qc"),
  subsetAdjust = "average",
  smooth = "loess",
)

loess fails (I did try to play with the span, no worries)

Rplot05

where linear does quite okayish but not really satisfying

pgp_subs <- PeakGroupsParam(
  minFraction = 0.8,
  subset = which(dda_data$sample_group == qc),
  subsetAdjust = "average",
  smooth = "linear",
)

Rplot04 Rplot02

Any idea?

Adafede avatar Nov 10 '20 10:11 Adafede

The problem you have with PeakGroupsParam is really strange. I guess this is independent of the subset-alignment and you get the same problem with the conventional full data set alignment?

Note that also the ObiwarpParam supports subset-based alignment. So you could try to see what you get with that?

jorainer avatar Nov 11 '20 10:11 jorainer

Oh, nice idea!

Indeed works nicely when wrapped in Obiwarp! I selected all samples except blanks :)

I also tried doing it on MS2 but looks like it is not implemented yet, will it be there soon?

Thanks a lot again!

Adafede avatar Nov 12 '20 12:11 Adafede

MS2 spectra get also adjusted along with the MS1 data (i.e. if you do the alignment in MS1, the retention time of the MS2 spectra gets also adjusted, based on the adjusted MS1 retention times).

Do you have a use case for only MS2 data alignment? I didn't implement because I didn't have the data and the use case...

jorainer avatar Nov 12 '20 12:11 jorainer

I have to admit I am very used to MZmine pipeline and some very MS2 oriented steps (chromatogram building for example) and also aligning based also on MS2 similarity. We had data for which taking into account MS2 similarity greatly lowered "false" alignment... this is why I was asking... it would not be MS2 only but the alignment of MS1 and MS2 based on MS2 (and not MS1)

Adafede avatar Nov 12 '20 13:11 Adafede

I have to admit I am very used to MZmine pipeline and some very MS2 oriented steps (chromatogram building for example) and also aligning based also on MS2 similarity. We had data for which taking into account MS2 similarity greatly lowered "false" alignment... this is why I was asking... it would not be MS2 only but the alignment of MS1 and MS2 based on MS2 (and not MS1)

@Adafede I think it is a very interesting idea. Could you point me to MS2-oriented alignment in MZmine?

If I understand correctly this is something similar to Peakgroup retention time alignment, though it is using MS2 similarity instead of m/z of MS1 to define the peak group. I assumed that It will be perfect for the targeted method. However, given the limited scan rates of MS2, will the MS2 data points be too sparse for alignment in untargeted metabolomics?

Thanks, Minghao Gong

gmhhope avatar Jun 29 '21 14:06 gmhhope

Hi @gmhhope, it is not really what you wrote, I probably explained it badly. What I mentioned was sort of an additional filter where you compare the associated MS2 spectra to decide whether to align MS1 peaks or not. Below a certain threshod, you simply do not aigne them even if within the mz/RT window because of their MS2 dissimilarity. Hope it is clearer now, if not I'll try another time!

@jorainer Is there, maybe combining multiple mzR packages and functions, a way to align dda-data and chromatograms (related to https://github.com/lgatto/MSnbase/issues/527)? For example, aligning UV signals together, MS1 together, and then UV-MS1?

Adafede avatar Jun 29 '21 14:06 Adafede

@Adafede : you can align chromatographic data with the alignRt function - but that only allows small shifts between chromatograms. For DDA data, xcms performs the alignment on the MS1 data, but adjusts the MS2 spectra measured in between the MS1 data too. For UV-MS1 - no idea - I'm not at all familiar with that data, sorry.

jorainer avatar Jun 29 '21 14:06 jorainer

@jorainer

Did you have a user case that has both MS1 and DDA-MS2 data in the same run? I would really like to see how you process the data comparing to the one with only MS1.

Thanks in advance!

Best, Minghao Gong

gmhhope avatar Jun 29 '21 17:06 gmhhope

This was a mistag - please tag the correct person.

johanne avatar Jun 29 '21 18:06 johanne

@gmhhope no, I don't have a use case or example workflow. But the alignment algorithms in xcms do the alignment by default always only on the MS1 data and MSn spectra are always adjusted separately based on the aligned MS1 data. There is nothing special the user has to do (or settings that have to be specified) for MS1+MS2 data - it's just like aligning MS1 data alone.

jorainer avatar Jun 30 '21 07:06 jorainer