Skip to content

Fix #185: thread censoredInt correctly and remove spurious unique() in exported script#210

Merged
swaraj-neu merged 1 commit into
develfrom
MSstatsShiny/work/20260514_censoredint_param_threading
May 15, 2026
Merged

Fix #185: thread censoredInt correctly and remove spurious unique() in exported script#210
swaraj-neu merged 1 commit into
develfrom
MSstatsShiny/work/20260514_censoredint_param_threading

Conversation

@swaraj-neu
Copy link
Copy Markdown
Contributor

@swaraj-neu swaraj-neu commented May 14, 2026

Motivation and Context

Issue #185 identified two problems in the MSstatsShiny codebase:

  1. The censoredInt parameter was not being properly threaded through the MSstatsHandleMissing function call in lf_summarization_loop, which was instead relying on a hardcoded missing value symbol
  2. The exported script code generated by getDataCode() contained an unnecessary unique() deduplication step that was producing spurious behavior for non-PTM inputs

This PR fixes both issues by ensuring the censored value indicator from user input is correctly propagated through the data processing pipeline and by removing an extraneous transformation from the generated code.

Changes

R/main_calculations.R

  • Refactored the MSstatsHandleMissing() call in lf_summarization_loop to use explicit named parameters
  • Changed missing_symbol parameter from a hardcoded "NA" value to dynamically use qc_input$censInt, ensuring the censored integer parameter is correctly threaded through the function
  • The censored_cutoff argument continues to derive from QC_check(qc_input, loadpage_input) but is now passed as a named parameter for improved code clarity
  • Lines changed: +7/-3

R/utils.R

  • Removed the spurious unique(as.data.frame(data)) transformation from the getDataCode() function
  • This eliminates an unnecessary deduplication step in the generated R script code for non-PTM inputs that was not part of the intended data processing pipeline
  • Lines changed: +0/-3

Tests

Existing unit tests in tests/testthat/test-main_calculations.R cover the lf_summarization_loop function, including tests that verify the correct summarization function is called based on the summary method selection. The test suite includes tests for both "linear" and "TMP" summary methods.

Tests in tests/testthat/test-utils.R validate that getDataCode() correctly generates character strings for various input configurations and file types.

Coding Guidelines

The changes adhere to the existing codebase conventions. The use of explicit named parameters in function calls improves code readability and reduces the risk of parameter order-related bugs.

Review Change Stack

@swaraj-neu swaraj-neu requested a review from tonywu1999 May 14, 2026 20:17
@swaraj-neu swaraj-neu self-assigned this May 14, 2026
@swaraj-neu swaraj-neu added the bug Something isn't working label May 14, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 611500e7-cffc-4393-9dd2-a0ed8ebb8e5e

📥 Commits

Reviewing files that changed from the base of the PR and between ba5966d and 8d76f6e.

📒 Files selected for processing (2)
  • R/main_calculations.R
  • R/utils.R
💤 Files with no reviewable changes (1)
  • R/utils.R

📝 Walkthrough

Walkthrough

This PR refactors missing value handling in the LF summarization pipeline by updating the MSstatsHandleMissing call to use named parameters and input-driven missing symbols, and removes redundant deduplication logic from code generation.

Changes

Summarization and Data Processing Refactor

Layer / File(s) Summary
MSstatsHandleMissing parameter refactoring
R/main_calculations.R
The lf_summarization_loop function refactors the MSstatsHandleMissing invocation to use named parameters and updates the missing-symbol parameter from the constant "NA" to qc_input$censInt, allowing missing value interpretation to be driven by input configuration.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • Vitek-Lab/MSstatsShiny#198: Both PRs modify R/main_calculations.R's LF/TMT summarization flow—this PR refactors lf_summarization_loop's MSstatsHandleMissing missing-value handling, while PR #198 changes the LF summarization selection and moderation argument passed to the TMT moderation t-test.

Poem

🐰 Named parameters now align,
No more "NA" cast in stone—
censInt takes the sign,
Dedupe fades when it's not shown,
Clean parameters, code well-defined!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main changes: fixing issue #185 by threading censoredInt correctly and removing an unnecessary unique() call in exported script.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch MSstatsShiny/work/20260514_censoredint_param_threading

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@swaraj-neu swaraj-neu linked an issue May 14, 2026 that may be closed by this pull request
@swaraj-neu swaraj-neu merged commit 0ac1c03 into devel May 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MSstats shiny vs MSstats in R discrepancies

2 participants