Open sneumann opened 8 years ago
Has this issue been solved yet? I'm encountering the same error. The instruction manual here (https://bioconductor.org/packages/release/bioc/vignettes/CAMERA/inst/doc/CAMERA.pdf) makes it seem so easy.
Hi Hani, I am afraid this is still unfixed. Patches welcome. Yours, Steffen
I was able to work around this error by setting xsAnnotate@sample
to a numeric.
Presumably, this is from not setting @sample
in xsAnnotate(xs=xset4, sample=NA, nSlaves=1, polarity=NULL)
.
It appears that xsAnnotate@sample
affects the intensity scale in the plotPsSpectrum plot.
Here's the workaround starting from xset8
:
# check the value
xset8@sample
# [1] NA
plotPsSpectrum(xset8, pspec=1, maxlabel=5)
# Error in if (!is.numeric(index) && index > length(sampnames(xs)) | index < :
# missing value where TRUE/FALSE needed
traceback()
# 3: getPeaks(object@xcmsSet, index = object@sample)
# 2: plotPsSpectrum(xset8, pspec = 1, maxlabel = 5)
# 1: plotPsSpectrum(xset8, pspec = 1, maxlabel = 5)
xset8@sample <- 1 # setting to 2, 3, ... 12 effects the intensity scale in PsSpectrum
plotPsSpectrum(xset8, pspec=1, maxlabel=5) # works
xset8@sample <- c(1:12)
plotPsSpectrum(xset8, maxlabel=5) # works with warnings
# WARNING: In if (is.na(object@sample)) { ...: the condition has length >1 and only the first element will be used
Starting from xset3
...
xset4 <- xsAnnotate(p_xset, sample=c(1:12), polarity="positive")
xset5 <- groupFWHM(xset4, perfwhm = 0.6)
xset6 <- groupCorr(xset5, cor_eic_th=0.75, pval=0.05, calcCiS = TRUE, cor_exp_th=0.75)
xset7 <- findIsotopes(xset6)
xset8 <- findAdducts(xset7, polarity="positive")
plotPsSpectrum(xset8, pspec=1, maxlabel=5) # works with several warnings
# Warning messages:
# 1: In if (!is.numeric(index) && index > length(sampnames(xs)) | index < :
# the condition has length > 1 and only the first element will be used
# 2: In if (index == -1) { :
# the condition has length > 1 and only the first element will be used
# 3: In if (is.na(object@sample)) { :
# the condition has length > 1 and only the first element will be used
I've found that setting xsAnnotate@sample <- 1
seems to work best.
It looks like changing CAMERA/R/xsVisualise.R#323 from:
##
## Loop through all requested pspectra
##
if (length(object@sample)<1) { #323
gvals <- groupval(object@xcmsSet);
peakmat <- object@xcmsSet@peaks;
groupmat <- groups(object@xcmsSet);
#calculate highest peak
max_mat <- apply(gvals, 1, function(x, peakmat){peakmat[x, value]}, peakmat);
}else{
peakmat <- getPeaks(object@xcmsSet, index=object@sample); #330
maxo <- peakmat[,value]
}
to:
if (is.na(object@sample) || length(object@sample)<1) { #323
might resolve the problem. However, the error actually occurs on line 330 peakmat <- getPeaks(object@xcmsSet, index=object@sample)
from the XCMS documentation for findPeaks, the method signature is findPeaks(xcmsSet, peakrange, step=0.1)
, which doesn't match the call on line 330. Unless this is supposed to be a call to CAMERA:::findPeaks(xcmsSet,psPeak,...)
.
From this thread, the suggestion is to use fillPeaks(xcmsSet,...)
instead of findPeaks(xcmsSet,...)
.
I'd rather not make the code change myself, as I may inadvertently break or change the expected behavior.
When will this fix make it into BioC? It is not in CAMERA 1.44.
Now pushed to BioC as Version: 1.45.1, should be on bioconductor.org/packages/devel/bioc/html/CAMERA.html in a few days. Yours, Steffen
Hi, this was reported by Mike at http://www.metabolomics-forum.com/viewtopic.php?f=24&t=911&p=2705#p2705.
Confirmed with