Skip to main content
Topic: What is the influence of BW in group upon retcor (Read 7842 times) previous topic - next topic

What is the influence of BW in group upon retcor

What does BW do?
The bw parameter or bandwidth controls the size of the retention time window for the groups. Too large or too small and few 'well behaved' groups will be found. You need just the right bw, goldilocks. Most of the time the run type will have a good default bw (HPLC~=30, UPLC~=10-20). The code below demonstrates how changing the bw parameter affects the retention time alignment and the number of detected groups. As the script run watch the retention time plots change.

Code: [Select]
library(xcms)
library(faahKO)

RetList<-list()
meanRet<-matrix(0, nrow=length(faahko@rt$raw[[1]]), ncol=length(seqBW))
seqBW<-seq(from=1, to=50, by=1)
for(i in seqBW){
gxs<-group(faahko, bw=i)
ret<-retcor(gxs, f="s", p="d")

foo<-unlist(ret@rt$corrected)
dim(foo)<-c(length(ret@rt$corrected[[1]]),length(ret@rt$corrected))
retMean<-rowMeans(foo)
RetList[[i]]<-foo
meanRet[,i]<-retMean
plot(0, xlim=c(from=min(foo), to=max(foo)), ylim=c(min(retMean - foo), max(retMean - foo)),
type="n", ylab="Ret Dev", xlab="retention time")
colRet<-rainbow(ncol(foo))
for(j in 1:ncol(foo)){
points(seq(from=min(foo), to=max(foo), length.out=1278), (retMean - foo[,j]), type="l", col=colRet[j])
}
cat(paste("BW: ", seqBW[i], " - Features:", nrow(groups(gxs)), "n", sep=""))
rm(ret)
gc()
}

Now we can see the mean difference between each bw. The following code is basically a repeat of the code above but using the mean retention time deviation between all samples.
Code: [Select]
 dim(meanRet)
## code to come
~~
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