Skip to content

Conversation

@tonywu1999
Copy link
Contributor

@tonywu1999 tonywu1999 commented Dec 4, 2025

Motivation and Context

For DIANN 2.0, 0s are being reported for missing values in some scenarios.

Changes

Replace zeros with NAs in DIANN converter for now.

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

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of zero intensity values in DIANN data conversion by treating them as missing values during preprocessing, ensuring more accurate downstream analysis.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 4, 2025

Walkthrough

The change introduces a data.table transformation in the DIANN-to-MSstats converter that replaces zero values in the Intensity column with NA before MSstatsBalancedDesign preprocessing. This modification targets zero intensity handling without altering other preprocessing steps or control flow.

Changes

Cohort / File(s) Summary
Intensity value transformation
R/converters_DIANNtoMSstatsFormat.R
Adds a data.table transformation that converts zero values in the Intensity column to NA, positioned prior to MSstatsBalancedDesign preprocessing

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Areas requiring attention:
    • Verify the positioning of the transformation within the preprocessing pipeline is correct
    • Confirm that converting zeros to NA aligns with MSstatsBalancedDesign's expectations
    • Check for any edge cases or downstream effects on intensity-based calculations

Poem

🐰 A zero becomes a mystery unknown,
NA whispers where silence has grown.
Before the balance is brought to the design,
The missing values now perfectly align! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is incomplete and lacks critical details required by the template. Add a detailed bullet point list of changes in the Changes section and describe any unit tests added or modified in the Testing section.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: converting zeros to NAs in the DIANN converter, which directly matches the primary modification in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bug-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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
R/converters_DIANNtoMSstatsFormat.R (2)

136-136: Prefer idiomatic data.table syntax for better performance.

The ifelse function creates a full-length vector even when only a subset needs modification. The idiomatic data.table approach directly subsets rows where the condition is true, which is more efficient.

Apply this diff:

-    input[, Intensity := ifelse(Intensity == 0, NA, Intensity)]
+    input[Intensity == 0, Intensity := NA]

136-136: Consider adding a log message for transparency.

Other transformations in this function (filtering, preprocessing) include logging messages. Adding a message here would make the zero-to-NA conversion explicit to users, improving observability.

Add logging before the transformation:

    msg = "** Converting zero intensities to NA"
    getOption("MSstatsLog")("INFO", msg)
    getOption("MSstatsMsg")("INFO", msg)
    input[Intensity == 0, Intensity := NA]
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c7756a9 and 59e6ba8.

📒 Files selected for processing (1)
  • R/converters_DIANNtoMSstatsFormat.R (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

@tonywu1999 tonywu1999 merged commit f4e6a97 into devel Dec 8, 2025
2 checks passed
@tonywu1999 tonywu1999 deleted the bug-diann branch December 8, 2025 14:48
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.

2 participants