Added options for nominal kendrick mass calculation #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It might be good to support different rounding methods to calculate nominal kendrick mass in kendrick mass defect calculations.
I noticed that corems uses
int(kendrick_mass)to calculate nominal kendrick mass, so the kendrick mass is always rounded down to the nearest integer. This isn’t the same nominal kendrick mass calculation as is performed in Hughey, Christine A., et al. (2001), in which the kendrick mass us rounded up to the nearest integer (e.g. for km = 350.9346 351, nkm = 360, kmd = 0.66). I’ve also seen nominal kendrick mass rounded up or down to nearest integer (e.g. Cody, Robert B., and Thierry Fouquet (2018) ).The differences aren’t too important for analyzing mass defect plots, but they could become confusing when you are comparing mass defects between studies.
This pull request adds three new rounding methods, ‘ceil’: nominal km always rounded up to the nearest integer, ‘round’: nominal km rounded up or down to the nearest integer and ‘floor’: (default) nominal km always rounded down to the nearest integer.
I haven’t added a settings attribute to the ICRMassPeak class so instead MsPeakCalc imports MSSettings to read kendrick_rounding_method. I can imagine it is a bit cleaner to instead use self.settings to read the rounding method, but I am unsure about messing with the classes too much.
Hopefully this is useful. The changes seem to work in my limited testing but might need some tidying up.
Thanks,
Ezra