The initial for loop in getDeconvolutedSpectrum goes fromi=0 to i < spectrum.size()-1, so it never checks the last peak (unless it's a z>=2 isotope of the second to last peak) and therefore it always gets clipped off from the deconvolutedSpectrum.
Changing the ending condition to i<spectrum.size() appears fine. The inner loop that looks for isotopes is j=i+1 to j<spectrum.size() so it won't go out of bounds even if i = spectrum.size()-1
The initial
for
loop in getDeconvolutedSpectrum goes fromi=0
toi < spectrum.size()-1
, so it never checks the last peak (unless it's a z>=2 isotope of the second to last peak) and therefore it always gets clipped off from the deconvolutedSpectrum.Changing the ending condition to
i<spectrum.size()
appears fine. The inner loop that looks for isotopes isj=i+1
toj<spectrum.size()
so it won't go out of bounds even ifi = spectrum.size()-1
My peptide IDs went up ~3% after fixing it