-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug in bin_Spectrum #137
Comments
@sgibb - this looks indeed correct. Could you check too. |
@sgibb @lgatto as a info: I'm presently implementing also a generic binning function in I've planned to replace with that function some or all of the |
The behaviour was indeed a little bit strange. The breaks |
@lgatto thanks; Sorry, I just tested the |
I think
bin_Spectrum
(https://github.com/lgatto/MSnbase/blob/master/R/functions-Spectrum.R#L296-L327) calculates one value too much:breaks
span the range fromfloor(min(mz(object)))
toceiling(max(mz(object)))
.[x, x+1]
should be summarized withfun
.intensity <- double(length(breaks))
but that's one value too much. The breaks define the start and end value for each bin, and the result should be the intensity values averaged within each bin. To my understanding intensity should thus beintensity <- double(length(breaks)-1)
, i.e. one value for each bin, but not for each break.mz <- breaks[-nb]+breaks[-1L])/2L
.The text was updated successfully, but these errors were encountered: