Open sneumann opened 9 years ago
So, the color palette and the indexing to the peaks seems garbled:
library(CAMERA)
file <- system.file('mzdata/MM14.mzdata', package = "CAMERA")
xs <- xcmsSet(file, method="centWave",ppm=30, peakwidth=c(5,10))
an <- xsAnnotate(xs)
an <- groupFWHM(an)
an <- findIsotopes(an)
an <- findAdducts(an, polarity="positive")
par(mfrow=c(2,3))
plotEICs(an, pspec=2, maxlabel=0)
plotEICs(an, pspec=2, maxlabel=1)
plotEICs(an, pspec=2, maxlabel=2)
plotEICs(an, pspec=2, maxlabel=6)
plotEICs(an, pspec=2, maxlabel=7)
plotEICs(an, pspec=2, maxlabel=99)
The problem is likely to be here: https://github.com/sneumann/CAMERA/blob/master/R/xsVisualise.R#L113
I seem to have tracked down the troublesome indices. Reproducing the example from @sneumann
library(CAMERA)
file <- system.file('mzdata/MM14.mzdata', package = "CAMERA")
xs <- xcmsSet(file, method="centWave",ppm=30, peakwidth=c(5,10))
an <- xsAnnotate(xs)
an <- groupFWHM(an)
an <- findIsotopes(an)
an <- findAdducts(an, polarity="positive")
par(mfrow=c(2,3))
plotEICs(an, pspec=2, maxlabel=0)
plotEICs(an, pspec=2, maxlabel=1)
plotEICs(an, pspec=2, maxlabel=2)
plotEICs(an, pspec=2, maxlabel=6)
plotEICs(an, pspec=2, maxlabel=7)
plotEICs(an, pspec=2, maxlabel=99)
gives this color coding scheme
However, if I change the indexing in xsVisualize.R ever so slightly here: https://github.com/sneumann/CAMERA/blob/master/R/xsVisualise.R#L101-L112 to the code below
for (j in eicidx[o]) {
pts <- xeic@eic[[ps]][[j]]
points(pts, type = "l", col = lcol[cnt]);
peakrange <- peaks[,c("rtmin","rtmax"), drop=FALSE]
ptsidx <- pts[,"rt"] >= peakrange[j,1] & pts[,"rt"] <= peakrange[j,2]
if (naps[j]){
points(pts[ptsidx, ], type = "l", col = col[cnt], lwd=1.3, lty=3)
} else {
points(pts[ptsidx, ], type = "l", col = col[cnt], lwd=1.3)
}
cnt <- cnt + 1;
}
then I get this (apparently correct) color-coding scheme
Hello Steffen,
It does not appear that this issue has been addressed at all. I am still seeing the same error with the color labels when using the plotEICs function of CAMERA. The bug fix that was suggested above by Jonathan Mosley seems to fix the problem.
The bug fix is the following:
Modify the following lines of code under the plotEICs method in xsVisualise.R from
for (j in eicidx[o]) {
pts <- xeic@eic[[ps]][[j]]
points(pts, type = "l", col = lcol[cnt]);
cnt <- cnt + 1;
peakrange <- peaks[,c("rtmin","rtmax"), drop=FALSE]
ptsidx <- pts[,"rt"] >= peakrange[j,1] & pts[,"rt"] <= peakrange[j,2]
if (naps[j]){
points(pts[ptsidx, ], type = "l", col = col[j], lwd=1.3, lty=3)
} else {
points(pts[ptsidx, ], type = "l", col = col[j], lwd=1.3)
}
}
to the following
for (j in eicidx[o]) { pts <- xeic@eic[[ps]][[j]] points(pts, type = "l", col = lcol[cnt]); peakrange <- peaks[,c("rtmin","rtmax"), drop=FALSE] ptsidx <- pts[,"rt"] >= peakrange[j,1] & pts[,"rt"] <= peakrange[j,2] if (naps[j]){ points(pts[ptsidx, ], type = "l", col = col[cnt], lwd=1.3, lty=3) } else { points(pts[ptsidx, ], type = "l", col = col[cnt], lwd=1.3) } cnt <- cnt + 1; }
Note that these changes are very minor. What do you think?
Regards,
Wilson Melendez
Reported by Andre Kleensang (Johns Hopkins University):
Die peakannotatioten sind anders in beiden Graphiken und damit ist unklar, ob der höchste peak (6e06) 132.099 [M1+H]+ (laut maxlabel=5) oder nicht zugeordnet ist (laut maxlabel=10).
As you can see the color labels are pointing to different peaks in the two versions of the same spectra.