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:
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):
# 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()