xcms
xcms copied to clipboard
tuneInPeakInfo breaks when peaks are < scale 4
Hi team! I've been noticing some warnings showing up when doing the tunein step of peak calling direct infusion data through the findChromPeaks function. I know this is probably more in the area of the massspecwavelet team, but I cannot find a github repo anywhere to ask them this :(
Basically, if you for example seach in scales c(1:7), and find a peak of scale 1, all is fine until you do the tuneIn step. The tuneIn step will search in 0.5 scale steps in a range of c(scale - 4, scale + 4), without checking for zero or minus scales resulting from this. Thus for a peak with initial scale 1 it tries to find one at -3... The authors seem to work with this by requiring all peaks to be above scale 5, but I would like to keep the options open for more narrow peaks if possible.
I think for the tuneIn step, Ideally the tuneInPeakInfo function would exclude scales below zero (see snippet at the bottom), but then they would have to make changes in the package itself and I couldn't find an easy way to contact them. Regardless, my not-so-clean insert in the tuneInPeakInfo function:
.... rest of function ....
if (length(scales.i) <= 1) {
peakScale.new <- c(peakScale.new, peakScale[i])
peakValue.new <- c(peakValue.new, peakValue[i])
peakCenterIndex.new <- c(peakCenterIndex.new, peakCenterIndex[i])
unProcessedInd <- c(unProcessedInd, i)
next
}
# my added line below
scales.i <- scales.i[scales.i>0]
.... rest of function ....
Any thoughts? I sneakily tried to override the tuneInPeakInfo function myself, but of course it's a locked binding so that wasn't going to work :(
Oh, and the warnings (+ more repeats of the same):
Warning messages:
1: In sqrt(scale.i) : NaNs produced
2: In sqrt(scale.i) : NaNs produced
3: In sqrt(scale.i) : NaNs produced
4: In sqrt(scale.i) : NaNs produced
5: In sqrt(scale.i) : NaNs produced
6: In sqrt(scale.i) : NaNs produced
7: In sqrt(scale.i) : NaNs produced
8: In sqrt(scale.i) : NaNs produced
9: In sqrt(scale.i) : NaNs produced
Thanks once again :) Cheers, Joanna
honestly, I have no idea whatsoever on this type of data. Eventually @sneumann has some insights?