Skip to content

fix: apply all modifications on a residue during feature encoding - #142

Open
chenyangsu wants to merge 1 commit into
CompOmics:mainfrom
chenyangsu:fix/multiple-modifications-per-residue
Open

chenyangsu wants to merge 1 commit into
CompOmics:mainfrom
chenyangsu:fix/multiple-modifications-per-residue

Conversation

@chenyangsu

Copy link
Copy Markdown

In deeplc/_features.py, _apply_modifications reads only token[1][0].composition when a residue carries multiple ProForma modifications. For PEPTIDK[Label:13C(6)15N(2)][Acetyl], the lysine row encodes as [6, 12, 2, 1, 0, 0] (matching unmodified PEPTIDK at -25.08 min rather than PEPTIDK[Acetyl] at -22.17 min), and PEPTIDK[Acetyl][Methyl] vs PEPTIDK[Methyl][Acetyl] encode differently ([8, 14, 2, 2, 0, 0] vs [7, 14, 2, 1, 0, 0]).

_apply_modifications now loops over every modification tag in token[1], matching _apply_terminal_modifications and the HUPO-PSI ProForma 2.0 specification so all compositions apply regardless of order. Happy to gate this behind legacy_positional_deltas instead if you prefer.

Testing: pytest tests -> 265 passed (including 4 new tests in tests/test_features.py). ruff check deeplc and ruff format --check --diff deeplc passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant