Skip to main content
Topic: matchedFilter parameters (Read 5875 times) previous topic - next topic

matchedFilter parameters

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.

Code: [Select]
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

Re: matchedFilter parameters

Reply #1
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.

Code: [Select]
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
~~
H. Paul Benton
Scripps Research Institute
If you have an error with XCMS Online please send me the JOBID and submit an error via the XCMS Online contact page

 

Re: matchedFilter parameters

Reply #2
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