Feat isotope-corrected mass error feature#187
Open
JemmaLDaniel wants to merge 3 commits intofeat-refactor-calibration-featuresfrom
Open
Feat isotope-corrected mass error feature#187JemmaLDaniel wants to merge 3 commits intofeat-refactor-calibration-featuresfrom
JemmaLDaniel wants to merge 3 commits intofeat-refactor-calibration-featuresfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Switch mass error feature to isotope-corrected signed ppm
Summary
Changes
MassErrorFeaturefrom computing a raw Dalton mass error to computing a signed mass error in parts per million (ppm) with isotope peak correction. This addresses two limitations of the previous implementation:Isotope peak selection -- when the instrument selects the M+1 or M+2 precursor isotope peak instead of the monoisotopic peak, the old Da error would be off by ~1.003 Da, encouraging the calibrator to penalise correct PSMs. The new implementation evaluates multiple isotope offsets (configurable via
isotope_error_range, default(0, 1)) and selects the one with the smallest absolute error.Size normalisation -- a 0.01 Da error means very different things for a 500 Da peptide (20 ppm) vs a 3000 Da peptide (3.3 ppm). The ppm unit normalises for peptide size, giving the calibrator a scale-invariant error measure.
The formula follows the convention used by InstaNovo:
Changes
winnow/calibration/features/mass_error.py:isotope_error_range: Tuple[int, int] = (0, 1).mass_errortomass_error_ppm.CARBON_ISOTOPE_MASS_SHIFTfromconstants.py.tests/calibration/features/test_mass_error.py-- rewritten with tests for: exact monoisotopic match (~0 ppm), formula verification, isotope correction selecting the best offset, sign preservation, invalid peptide handling, and custom residue masses.docs/api/features/mass_error.md-- updated to document the new formula, isotope correction, ppm output, andisotope_error_rangeparameter.