Skip to content

deprecation(groupComparisonPTM): Deprecate data.type parameter#124

Merged
tonywu1999 merged 3 commits intodevelfrom
refactor-group-comparison
Feb 10, 2026
Merged

deprecation(groupComparisonPTM): Deprecate data.type parameter#124
tonywu1999 merged 3 commits intodevelfrom
refactor-group-comparison

Conversation

@tonywu1999
Copy link
Contributor

@tonywu1999 tonywu1999 commented Feb 9, 2026

Summary by CodeRabbit

  • Breaking Changes

    • Replaced the single legacy labeling parameter with two explicit public parameters to select labeling types for PTM and protein data; callers must now specify PTM and protein label types separately.
  • Documentation

    • Updated user-facing docs and usage examples to reflect the new parameter names, accepted values, and defaults for PTM and protein labeling.

@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

📝 Walkthrough

Walkthrough

The groupComparisonPTM API was changed: data.type was removed and replaced by two explicit parameters, ptm_label_type and protein_label_type. Deprecation handling and related logging scaffolding tied to data.type were removed and documentation updated.

Changes

Cohort / File(s) Summary
Function Implementation
R/groupComparisonPTM.R
Removed data.type from the signature, added ptm_label_type and protein_label_type as public arguments (c("LF","TMT")), replaced internal data.type handling with match.arg initialization, and removed related deprecation and logging scaffolding.
Documentation
man/groupComparisonPTM.Rd
Updated usage and arguments: removed data.type, added ptm_label_type and protein_label_type entries and descriptions, and adjusted examples/usage blocks to match the new signature.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Two labels now, not one, I cheer,
PTM and protein hopping near,
Old warnings gone, the logs set free,
Clearer args for you and me —
A tiny hop, a tidy cheer!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is empty except for the template structure; no motivation, context, detailed changes, or testing information was provided by the author. Complete the pull request description with: (1) Motivation and Context explaining why data.type is being deprecated, (2) Detailed bullet-point list of all changes made, (3) Description of unit tests added/modified, and (4) Checked items in the pre-review checklist.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title describes deprecating data.type, which is directly related to the main change of removing data.type and adding ptm_label_type and protein_label_type parameters.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ 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 refactor-group-comparison

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

@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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
R/groupComparisonPTM.R (1)

114-117: ⚠️ Potential issue | 🟡 Minor

Inconsistent use_log_file argument between PTM and protein groupComparison calls.

Line 146 passes use_log_file as a positional argument to groupComparison for the protein model, but the equivalent PTM call on line 114-115 does not. This means the PTM LF path omits use_log_file while the protein LF path includes it. Either both calls should pass it or neither should.

Also applies to: 144-148

🤖 Fix all issues with AI agents
In `@R/groupComparisonPTM.R`:
- Around line 58-59: Validate the incoming ptm_label_type and protein_label_type
using match.arg (e.g., allowed = c("TMT","LF")) at the start of the function so
invalid values error early with a clear message; then use the validated
variables when building ptm_model_full and protein_model_full so those objects
are always defined for the subsequent branching logic (referencing
ptm_label_type, protein_label_type, ptm_model_full, protein_model_full). Ensure
you replace any raw string comparisons with the validated variables and do not
proceed to construct models unless match.arg succeeded.
🧹 Nitpick comments (2)
R/groupComparisonPTM.R (2)

85-85: Significant amount of commented-out logging code left behind.

There are ~15 blocks of commented-out logging calls (getOption(option_log), log_file_path references) scattered throughout the function. Consider removing them to reduce noise, or if logging is planned for re-introduction, track it in an issue instead.

Also applies to: 99-99, 105-108, 113-113, 116-117, 130-130, 136-139, 143-143, 147-148, 157-157, 162-162, 169-170, 209-209


56-68: Roxygen @param order doesn't match the function signature.

ptm_label_type and protein_label_type are the 3rd and 4th parameters in the signature but are documented after base in the roxygen block (lines 43-46). While roxygen2 handles this, matching the order improves readability.

Copy link

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
R/groupComparisonPTM.R (1)

60-72: ⚠️ Potential issue | 🟠 Major

Breaking change disguised as deprecation — data.type removed without a deprecation path.

The PR title says "Deprecate data.type parameter," but the parameter is fully removed. Any downstream code calling groupComparisonPTM(..., data.type = "TMT") will fail immediately with an unexpected-argument error. A proper deprecation would retain data.type with a warning, map it to the new parameters, and schedule removal for a future release.

Suggested deprecation shim (add to function body after match.arg calls)
 groupComparisonPTM = function(data, 
                               contrast.matrix = "pairwise",
                               ptm_label_type = c("LF", "TMT"),
                               protein_label_type = c("LF", "TMT"),
                               moderated = FALSE, 
                               adj.method = "BH",
                               log_base = 2,
                               save_fitted_models=TRUE,
                               use_log_file = TRUE, 
                               append = FALSE,
                               verbose = TRUE, 
                               log_file_path = NULL,
-                              base = "MSstatsPTM_log_") {
+                              base = "MSstatsPTM_log_",
+                              data.type = deprecated()) {
   
   Label = Site = NULL
+  
+  if (lifecycle::is_present(data.type)) {
+    lifecycle::deprecate_warn(
+      "2.x.0",
+      "groupComparisonPTM(data.type)",
+      "groupComparisonPTM(ptm_label_type)"
+    )
+    ptm_label_type = data.type
+    protein_label_type = data.type
+  }
+  
   ptm_label_type = match.arg(ptm_label_type)
   protein_label_type = match.arg(protein_label_type)
🧹 Nitpick comments (1)
R/groupComparisonPTM.R (1)

91-91: Clean up commented-out logging code.

There are ~15 blocks of commented-out getOption(option_log)(...) and related logging calls scattered throughout the function. Since the logging scaffolding has been intentionally removed, these remnants add noise. Consider removing them in this PR to keep the diff clean for future readers.

Also applies to: 105-105, 111-114, 119-119, 136-136, 142-145, 149-149, 153-154, 163-163, 168-168, 175-176, 215-215

@tonywu1999 tonywu1999 merged commit ac52a8b into devel Feb 10, 2026
2 checks passed
@tonywu1999 tonywu1999 deleted the refactor-group-comparison branch February 10, 2026 19:04
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