Hi to everybody,
I'm setting up an xcms object using the
matchedFilter algorithm. So, reading the Smith's paper (XCMS: Processing Mass Spectrometry....) I'm adjusting s/n and fwhm parameters to obtain the best result.
xsetSUP <- xcmsSet(files, method="matchedFilter", snthresh=8, fwhm=10, sleep=1)
My question is about the red horizontal line: I think is regulated by the s/n so, the higher is the s/n the higher is the red line. Is it right?? Is the red line used as baseline to integrate the signal?? How it is calculated the s/n ratio?? RMS or Peak to peak??
Best
Riccardo
Riccardo,
Yep the red line indicates the calculated signal to noise level. A peak above this line should get picked and integrated. I would like to give the formula for this but latex doesn't work on the forum :( . Second best option is the actual code for it.
specNoise <- function(spec, gap = quantile(diff(spec[,"mz"]), .9)) {
# In a spectrum with just one raw peak we can't calculate noise
if (nrow(spec) < 2) {
return(0)
}
intmean <- mean(spec[,"intensity"])
mzlen <- diff(range(spec[,"mz"]))
mzdiff <- diff(spec[,"mz"])
gaplen <- sum(mzdiff[mzdiff > gap])
weighted.mean(c(intmean, min(spec[,"intensity"])/2), c(1 - gaplen/mzlen,
gaplen/mzlen))
}
where spec is a single scan. It comes to this function as a matrix of columns mz and intensity.
Let me know if this is clear. Otherwise I can try and explain the way it works.
Paul
Hi Paul,
reading the code you wrote I think I understand what you mean but I haven' t understand the way to use the function you wrote, because is not clear in my mind how to extract a scan from an xcmsSet object :oops: .
Can you explain it to me??
Regards