Skip to content

fix(turnover): Fix DIANN 1.8 processing of protein turnover labeling#140

Open
tonywu1999 wants to merge 1 commit into
develfrom
fix-diann
Open

fix(turnover): Fix DIANN 1.8 processing of protein turnover labeling#140
tonywu1999 wants to merge 1 commit into
develfrom
fix-diann

Conversation

@tonywu1999

@tonywu1999 tonywu1999 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

Please include relevant motivation and context of the problem along with a short summary of the solution.

Changes

Please provide a detailed bullet point list of your changes.

Testing

Please describe any unit tests you added or modified to verify your changes.

Checklist Before Requesting a Review

  • I have read the MSstats contributing guidelines
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Motivation and context

DIANN 1.8 turnover labeling in MSstatsConvert was not handling ModifiedSequence labels flexibly enough. The fix generalizes isotope-label parsing so turnover/labeled peptides can be recognized even when the label token is not literally SILAC.

Summary of solution

The DIANN parsing logic was updated to detect generic label suffixes of the form (<label>-<AA>-H/L) and to strip them from peptide sequences while assigning the correct isotope label type.

Detailed changes

  • Updated .assignDIANNIsotopeLabelType() to support generic label tokens instead of only SILAC.
  • Reworked the ModifiedSequence parsing regexes to match:
    • (<label>-<AA>-H)
    • (<label>-<AA>-L)
      where <label> is any non-dash token and <AA> is restricted to the configured labeled amino acids.
  • Kept channel-based DIANN behavior unchanged.
  • Updated warning text to reflect the generalized suffix pattern.
  • Updated roxygen and generated Rd documentation across DIANN conversion and cleaning docs to describe the new generic parsing behavior.
  • Added a regression test covering:
    • SILAC-K-H/L
    • generic (label-K-H/L)
    • an unlabeled peptide
      verifying correct IsotopeLabelType assignment and peptide stripping.

Tests

  • Added/updated tinytest coverage in inst/tinytest/test_clean_DIANN.R for generalized ModifiedSequence label parsing.

Coding guidelines

  • No coding guideline violations noted.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Isotope-label suffix parsing in DIANN ModifiedSequence handling is generalized from SILAC-specific patterns to accept any non-dash label token before the --H/L suffix. Regex construction, warning text, tests, and documentation across R source and .Rd files are updated accordingly.

Changes

Generic isotope-label suffix parsing

Layer / File(s) Summary
Generalize regex and warning logic
R/clean_DIANN.R
heavy_regex, light_regex, and strip_regex now match any non-dash label token before -<AA>-H/L instead of requiring SILAC-; the "no rows classified" warning and function docs are updated to match.
Test coverage for generic label tokens
inst/tinytest/test_clean_DIANN.R
New test asserts .assignDIANNIsotopeLabelType() correctly classifies SILAC-K-H/L, generic (label-K-H/L), and unlabeled peptides, and strips suffixes to PEPTIDEK.
Documentation updates for generic suffix format
R/converters_DIANNtoMSstatsFormat.R, man/DIANNtoMSstatsFormat.Rd, man/MSstatsClean.Rd, man/dot-cleanRawDIANN.Rd
Roxygen and generated docs are reworded to describe the (<label>-<AA>-H/L) suffix pattern instead of the SILAC-specific format.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Poem

A dash, a label, any old name,
No longer just SILAC plays the game,
H's and L's now parse with grace,
Stripped clean sequences fall into place,
This bunny hops through regex delight! 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is only the untouched template and does not provide real motivation, changes, or testing details. Replace the template text with a real summary of motivation, a bullet list of changes, and the unit tests you added or modified.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the DIANN turnover-labeling changes, though it is broader than the specific generic-label parsing update.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-diann

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
R/clean_DIANN.R (1)

268-276: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider consolidating the three regex constructions.

heavy_regex, light_regex, and strip_regex repeat the same \\([^-]+-(?:aa_pattern)-... scaffold with only the trailing suffix differing. A single pattern with a capture group (e.g. matching -([HL])\)) could drive both classification and stripping, reducing the chance of the three patterns drifting out of sync during future edits.

♻️ Possible consolidation
-        heavy_regex <- paste0("\\([^-]+-(?:", aa_pattern, ")-H\\)")
-        light_regex <- paste0("\\([^-]+-(?:", aa_pattern, ")-L\\)")
-        strip_regex <- paste0("\\([^-]+-(?:", aa_pattern, ")-[HL]\\)")
+        label_regex <- paste0("\\([^-]+-(?:", aa_pattern, ")-([HL])\\)")
+        heavy_regex <- paste0("\\([^-]+-(?:", aa_pattern, ")-H\\)")
+        light_regex <- paste0("\\([^-]+-(?:", aa_pattern, ")-L\\)")
+        strip_regex <- label_regex
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@R/clean_DIANN.R` around lines 268 - 276, The three regex variables in
clean_DIANN reuse the same scaffold and should be consolidated to avoid drift.
Update the regex construction near .classifyIsotopeLabelType so a single shared
pattern (with a capture for the H/L suffix) can be used to derive heavy_regex,
light_regex, and strip_regex consistently, while keeping the current behavior in
dn_input and PeptideSequence stripping.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@R/clean_DIANN.R`:
- Around line 268-276: The three regex variables in clean_DIANN reuse the same
scaffold and should be consolidated to avoid drift. Update the regex
construction near .classifyIsotopeLabelType so a single shared pattern (with a
capture for the H/L suffix) can be used to derive heavy_regex, light_regex, and
strip_regex consistently, while keeping the current behavior in dn_input and
PeptideSequence stripping.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dfd2c1d6-44a4-4b94-b81f-368001b9392e

📥 Commits

Reviewing files that changed from the base of the PR and between dbf8afb and 1505e43.

📒 Files selected for processing (6)
  • R/clean_DIANN.R
  • R/converters_DIANNtoMSstatsFormat.R
  • inst/tinytest/test_clean_DIANN.R
  • man/DIANNtoMSstatsFormat.Rd
  • man/MSstatsClean.Rd
  • man/dot-cleanRawDIANN.Rd

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant