Skip to content

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

Merged
tonywu1999 merged 3 commits into
develfrom
fix-diann
Jul 10, 2026
Merged

fix(turnover): Fix DIANN 1.8 processing of protein turnover labeling#140
tonywu1999 merged 3 commits into
develfrom
fix-diann

Conversation

@tonywu1999

@tonywu1999 tonywu1999 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

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.

Motivation and Context

DIANN 1.8 can encode protein-turnover labels in ModifiedSequence using label tokens beyond SILAC. Previously, MSstatsConvert recognized only SILAC-specific suffixes, preventing correct classification of generic labels.

The parser now supports (<label>-<AA>-H/L) suffixes with configured labeled amino acids, strips recognized annotations, and preserves existing channel-based DIANN behavior.

Changes

  • Generalized DIANN isotope-label parsing to accept any non-dash label token.
  • Added heavy/light suffix matching and annotation stripping for configured amino acids.
  • Updated warnings and DIANN-related roxygen/Rd documentation.
  • Added regression coverage for:
    • SILAC-K-H/L
    • Generic labels such as label-K-H/L
    • Unlabeled peptides
  • Added generated documentation for .cleanRawProteinProspector.

Unit Tests

  • Extended .assignDIANNIsotopeLabelType tests to verify:
    • Correct H/L classification.
    • NA for unlabeled peptides.
    • Removal of label suffixes from PeptideSequence.

Coding Guidelines

  • No coding guideline violations identified.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@tonywu1999, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 56 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a5a0bf23-95e7-4e5c-8f2d-bd6309c629c7

📥 Commits

Reviewing files that changed from the base of the PR and between 144b82b and 780e864.

📒 Files selected for processing (1)
  • inst/tinytest/test_clean_DIANN.R
📝 Walkthrough

Walkthrough

Isotope-label suffix parsing in DIANN ModifiedSequence handling now accepts any non-dash label token before the amino-acid H/L suffix. Regexes, warnings, tests, and documentation are updated, and internal ProteinProspector documentation is generated.

Changes

Generic isotope-label suffix parsing

Layer / File(s) Summary
Generalize DIANN parsing logic
R/clean_DIANN.R
Regexes now match generic label tokens while restricting amino acids to labeledAminoAcids; related documentation and warnings are updated.
Validate generic label classification
inst/tinytest/test_clean_DIANN.R
Tests cover SILAC labels, generic labels, unlabeled peptides, H/L/NA classification, and suffix stripping.
Update DIANN suffix documentation
R/converters_DIANNtoMSstatsFormat.R, man/DIANNtoMSstatsFormat.Rd, man/MSstatsClean.Rd, man/dot-cleanRawDIANN.Rd
Documentation describes generic (<label>-<aminoAcid>-H/L) suffixes and retained classification and stripping behavior.

ProteinProspector documentation

Layer / File(s) Summary
Publish internal function documentation
R/clean_ProteinProspector.R, man/dot-cleanRawProteinProspector.Rd
The internal function is documented with its usage, argument, return type, and metadata.

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

Possibly related PRs

Suggested reviewers: mstaniak

Poem

A label hops beyond SILAC’s gate,
H and L now sort their fate,
Peptides shed their tagged disguise,
While docs grow under moonlit skies,
This bunny cheers the tidy trace! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main DIANN turnover-label parsing fix.
Description check ✅ Passed The description covers motivation, changes, and testing in a detailed structure; only the checklist section from the template is missing.
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

@tonywu1999
tonywu1999 merged commit 038dd5d into devel Jul 10, 2026
1 check passed
@tonywu1999
tonywu1999 deleted the fix-diann branch July 10, 2026 19:00
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