Skip to main content
Topic: Beginner to MS, how to pick parameters? (Read 4713 times) previous topic - next topic

Beginner to MS, how to pick parameters?

Hi forum,

I have no idea or how to evaluate if my parameters were good. I was wondering if anyone could recommend parameters for a UPLC LC-MS run done on Bruker maXis impact in positive mode. The run was 22 minutes long, and m/z scan range was 50-2000. I basically have been trying to assess what kind of peak width parameter to use, profStep for grouping, and furthermore how to evaluate if the features detected are reliable and of best quality(?). My ultimate goal is to create an excel like document (csv or tab delimited) of the m/z ions detected, the retention time, and the intensity of that ion detected throughout my samples. Is something like this possible with XCMS?

I'm sorry if this question is incredibly basic, but I am having a hard time getting started and I have no idea how to evaluate my results from XCMS. Here is previous parameters I have used:

xset_cent20 <- xcmsSet(files,method="centWave", ppm=20, snthr=10,peakwidth=c(5,25), integrate = 2)
xset_cent20g<- group(xset_cent20)
xset_cor20<- retcor(xset_cent20g)

Re: Beginner to MS, how to pick parameters?

Reply #1
Your parameters sound pretty good to me for the most part. A few notable differences between what you're doing and what I usually do:
* I set integrate to 1 instead of 2 in the xcmsSet step.
* I set more of my parameters in the group step. Here is how I typically do it:
Code: [Select]
group(xset_cent20, method="density", bw=4, minfrac=0, minsamp=1, mzwid=0.007, max=100)

One thing I do to make sure that I'm getting peaks that look reasonable is I randomly pick 10 samples and 30 mass features and plot their chromatograms before and after retention time correction and also plot their raw mass spectral data. Here is an example of how I do it (modify this code to suit your needs):
Code: [Select]
# MyData is my peak table.
# Samples are the samples I've processed
# MyData.filledpeaks are the data after the fillpeaks() step

MFs <- as.numeric(sample(row.names(MyData), 30))
RandSamp <- as.numeric(sample(length(Samples), 10))
write.csv(MFs, paste(Sys.Date(), "Randomly selected mass features.csv"))
write.csv(RandSamp, paste(Sys.Date(), "Randomly selected samples.csv"))

EIC.uncorrected <- list()
EIC.corrected <- list()

# This next step will take some time to process, so don't expect instant results.
for (m in MFs){
      EIC.uncorrected[[m]] <- getEIC(MyData.filledpeaks, rt="raw", groupidx=m, sampleidx=RandSamp)
      EIC.corrected[[m]] <- getEIC(MyData.filledpeaks, rt="corrected", groupidx=m, sampleidx=RandSamp) 
}


ColRainbow <- colorRampPalette(c("green", "blue", "purple"))
MyColors <- c(ColRainbow(length(RandSamp)-1), "red")

xset.raw <- xcmsRaw(Samples[RandSamp[10]], profstep=0.01, profmethod="bin")

pdf(paste(Sys.Date(), "MyData EICs and mass spectra of random mass features.pdf"), 8.5,11)

# 1st column shows the uncorrected EICs.
# 2nd column shows the RT-corrected EICs.
# 3rd column shows the m/z vs. RT for the 1st sample for that compound with a
# dashed horizontal line where the calculated m/z is.

par(mfrow=c(4,3), mar=c(3,3,3,0.5))
for(i in 1:30){
      m <- MFs[i]
      plot(EIC.uncorrected[[m]], MyData.filledpeaks, groupidx=1, rtrange=60, col=MyColors, main=MFs[m])
      mtext(paste(i, MyData.peaks$MassFeature[m]), side=3, line=-1, adj=0, padj=0, cex=0.8)
      plot(EIC.corrected[[m]], MyData.filledpeaks, groupidx=1, rtrange=60, col=MyColors)
     
      RT <- MyData.peaks$rt[m]
      RTRange <- c(RT-30, RT+30)
     
      mz <- MyData.peaks$mz[m]
      mzRange <- c(mz-0.02, mz+0.02)
      mzRange.poly.low <- mz- mz*7.5/1e6
      mzRange.poly.up <- mz*7.5/1e6 + mz
     
      plotRaw(xset.raw, mzrange=mzRange, rtrange=RTRange, log=FALSE)
      abline(h=mz, lty=2, col="gray35")
      mtext(paste("abund =", round(MyData.peaks[m, (length(RandSamp))], digits=0)), side=3, line=-1, adj=0, padj=0, cex=0.8)
      polygon(c(RTRange[2], RTRange[1], RTRange[1], RTRange[2]),
              c(mzRange.poly.up, mzRange.poly.up, mzRange.poly.low, mzRange.poly.low),
              col=col2alpha("blue", alpha=0.1), border=NA)
      abline(v=RT, lty=2, col="gray35")
     
}

dev.off()