Skip to content

Conversation

@tonywu1999
Copy link
Contributor

@tonywu1999 tonywu1999 commented Sep 18, 2025

Motivation and Context

DataProcessPlots in MSstats is generating warnings of deprecated functions in ggplot.

Changes

  • Migrate from aes_string to aes
  • Migrate from size to linewidth for geom_line, geom_hline functions

Testing

Deprecation messages disappear.

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
  • I have run the devtools::document() command after my changes and committed the added files

PR Type

Enhancement


Description

  • Replace aes_string with aes across plots

  • Use .data pronoun for tidy evaluation

  • Update ggplot mappings and labels

  • Minor formatting and EOF newline adjustments


Diagram Walkthrough

flowchart LR
  A["Legacy ggplot aes_string()"] -- "refactor" --> B["ggplot aes() + .data pronoun"]
  B -- "apply across modules" --> C["QC/profile/comparison/volcano plots"]
Loading

File Walkthrough

Relevant files
Enhancement
groupComparisonQCPlots.R
Refactor QC plots to aes with .data                                           

R/groupComparisonQCPlots.R

  • Switch qqplot mapping to aes(sample = .data$residual)
  • Refactor residuals vs fitted to aes(x = .data$fitted, y =
    .data$residual)
  • Minor whitespace/EOF newline change
+3/-3     
utils_dataprocess_plots.R
Modernize data process plots to tidy-eval aes                       

R/utils_dataprocess_plots.R

  • Convert profile plots to aes using .data and [[type_color]]
  • Update geom_text/points to .data mappings
  • Refactor summary profile and QC/condition plots to aes()
  • Minor formatting and EOF newline changes
+22/-22 
utils_groupcomparison_plots.R
Update group comparison plots to aes/.data                             

R/utils_groupcomparison_plots.R

  • Refactor volcano plot aesthetics to aes with .data
  • Update geom_text_repel and guide lines to tidy-eval
  • Convert comparison plots to aes and .data
+12/-12 

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability of QC, residual, volcano, and group-comparison plots; fixes for label rendering and dynamic color/shape/fill mappings to reduce warnings and failures.
  • Refactor

    • Modernized internal plotting logic for greater robustness and future compatibility while preserving the public API and outputs.
  • Chores

    • Added a small package dependency to support the plotting updates.

@coderabbitai
Copy link

coderabbitai bot commented Sep 18, 2025

Walkthrough

Replaces ggplot2 aes_string and implicit/unquoted aesthetics with aes() using the .data pronoun across QC, data-processing, and group-comparison plotting code; adds data = bindings and switches some size to linewidth. Also adds rlang import (.data) to DESCRIPTION/NAMESPACE. No public API changes.

Changes

Cohort / File(s) Summary
QC plot tidy-eval updates
R/groupComparisonQCPlots.R
Switched QQ and residual plot aesthetics from aes_string/implicit names to aes() with .data$... references; bound data = sub.residuals.table; no signature changes.
Data-processing plot tidy-eval updates
R/utils_dataprocess_plots.R
Replaced aes_string() with aes() and qualified columns via .data$... / .data[[...]]; changed ggplot(input, ...) to ggplot(data = input, ...); adjusted line geom sizelinewidth; no API changes.
Group-comparison plot tidy-eval updates
R/utils_groupcomparison_plots.R
Replaced aes_string() with aes() using .data$... / .data[[...]] for dynamic columns (e.g., logFC, p-value/adjp, labels, line), added data = input, and standardized geom linewidth; no signature changes.
Package metadata / namespace
DESCRIPTION, NAMESPACE, R/msstats-package.R
Added rlang to DESCRIPTION Imports and importFrom(rlang, .data) to NAMESPACE (and corresponding import line in package file) to enable .data pronoun; RoxygenNote bumped; metadata-only changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • devonjkohler
  • mstaniak
  • anshuman-raina

Poem

I hop through plots where mappings gleam,
Strings tuck away for a tidy dream.
With .data paws I nudge each trace,
Residuals find their proper place.
Volcanoes smile — carrots for the chase 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The description includes Motivation and Context, Changes, Testing, and Checklist sections following the repository template, but the Testing section only notes that deprecation warnings disappear without describing any unit tests added or modified to verify the changes, leaving verification steps and coverage unclear. Please expand the Testing section to specify what unit tests were added or modified, include details about test cases or commands used, and outline their expected outcomes to verify the changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly summarizes the core change by indicating migration away from deprecated ggplot functions in the dataProcessPlots and groupComparisonPlots modules. It clearly references the affected components and the nature of the change, making it descriptive and specific enough for team members scanning history. The phrasing is concise, avoids vague terms, and does not include unnecessary details. Therefore, it meets the repository’s guidelines for a clear, focused title.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-ggplot

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
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

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

@github-actions
Copy link

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Aesthetics Mapping

In several layers you map aesthetics both globally and per-layer; confirm that the intended groupings/legends persist (e.g., linetype by FEATURE and color by dynamic columns) and that .data[[type_color]] correctly resolves when type_color changes.

profile_plot = ggplot(input, aes(x = .data$RUN, y = .data$newABUNDANCE,
                                        color = .data[[type_color]], linetype = .data$FEATURE)) +
    facet_grid(~LABEL) +
    geom_line(size = 0.5)

if (is_censored) {
    profile_plot = profile_plot +
    geom_point(aes(x = .data$RUN, y = .data$newABUNDANCE, color = .data[[type_color]], shape = .data$censored),
               data = input,
               size = dot.size.profile) +
    scale_shape_manual(values = c(16, 1),
                       labels = c("Detected data", "Censored missing data"))
Dynamic Column Access

Usage of .data[[log_adjp]] inside aes relies on a character variable; verify that log_adjp always matches a column in input and that guides/labels reflect the chosen scale (log base).

Protein = NULL
plot = ggplot(aes(x = .data$logFC, 
                         y = .data[[log_adjp]],
                         color = .data$colgroup,
                         label = .data$Protein),
              data = input) +
    geom_point(size = dot.size) +
    scale_colour_manual(values = c("gray65", "blue", "red"), 
                        limits = c("black", "blue", "red"), 
Tidy Eval Consistency

Switched to aes(sample = .data$residual) for qq plot; ensure this works with stat="qq" across supported ggplot2 versions and that residual column is present without masking.

plot = ggplot(sub.residuals.table, aes(sample = .data$residual)) +
    geom_point(stat = "qq", alpha = 0.8, 
               shape = 20, size = dot.size) +
    scale_shape(solid=FALSE) + 
    geom_abline(slope = slope, intercept = int, colour = "red") +

@github-actions
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Guard dynamic y-aesthetic column

Mapping y = .data[[log_adjp]] requires log_adjp to be a valid column name string.
Add a guard that ensures log_adjp exists in input, otherwise stop early with a clear
error to prevent non-standard evaluation failures at plot time.

R/utils_groupcomparison_plots.R [192-196]

+if (!log_adjp %in% names(input)) {
+  stop("Column specified by 'log_adjp' not found in input data.")
+}
 plot = ggplot(aes(x = .data$logFC, 
-                         y = .data[[log_adjp]],
-                         color = .data$colgroup,
-                         label = .data$Protein),
+                  y = .data[[log_adjp]],
+                  color = .data$colgroup,
+                  label = .data$Protein),
               data = input) +
Suggestion importance[1-10]: 7

__

Why: Verifying log_adjp exists before using .data[[log_adjp]] addresses a potential runtime failure in the updated volcano plot mapping; this is pertinent and accurate given the dynamic column name.

Medium
Validate dynamic aesthetic column

Using .data[[type_color]] inside aes() can error if type_color is not a column name
at runtime. Validate and coerce type_color to a safe column selection before
mapping. Fallback to a default column or stop with a clear message to avoid cryptic
evaluation errors.

R/utils_dataprocess_plots.R [59-61]

+if (!type_color %in% names(input)) {
+  stop("Column specified by 'type_color' not found in input data.")
+}
 profile_plot = ggplot(input, aes(x = .data$RUN, y = .data$newABUNDANCE,
-                                        color = .data[[type_color]], linetype = .data$FEATURE)) +
+                                 color = .data[[type_color]], linetype = .data$FEATURE)) +
Suggestion importance[1-10]: 6

__

Why: Guarding that type_color exists before using .data[[type_color]] can prevent confusing NSE errors and is aligned with the PR’s shift to tidy-eval. It's a reasonable safety check, though not critical and context suggests type_color is controlled.

Low
General
Ensure numeric QQ sample data

stat="qq" in geom_point expects a numeric sample. Ensure residual is numeric to
avoid runtime errors with .data pronoun and computed stats. Coerce or validate the
column before plotting.

R/groupComparisonQCPlots.R [124-129]

+sub.residuals.table$residual <- as.numeric(sub.residuals.table$residual)
 plot = ggplot(sub.residuals.table, aes(sample = .data$residual)) +
Suggestion importance[1-10]: 5

__

Why: Ensuring residual is numeric can avoid stat="qq" errors and is harmless, but residuals are typically numeric already; thus impact is moderate though the suggestion is correct.

Low

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

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

237-237: Minor: prefer explicit data arg; otherwise looks good

Boxplot and text layers use .data correctly. Consider making the ggplot call explicit for consistency.

-ggplot(input, aes(x = .data$RUN, y = .data$ABUNDANCE)) +
+ggplot(data = input, aes(x = .data$RUN, y = .data$ABUNDANCE)) +

Also applies to: 240-240, 248-248

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f502591 and d6b1c3f.

📒 Files selected for processing (3)
  • R/groupComparisonQCPlots.R (3 hunks)
  • R/utils_dataprocess_plots.R (8 hunks)
  • R/utils_groupcomparison_plots.R (6 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
🔇 Additional comments (10)
R/utils_dataprocess_plots.R (4)

100-104: LGTM: label layer converted to tidy-eval correctly

.data$RUN/.data$ABUNDANCE/.data$Name usage is correct and avoids NSE notes.


159-161: Verify analysis levels align with manual scales

Mapping color/size/linetype to .data$analysis looks good. Please confirm input$analysis has exactly the expected two levels and matches the values passed to scale_colour_manual and scale_size_manual, or you’ll get dropped/empty legends.

Also applies to: 168-175, 195-195


212-213: LGTM: late point layer inherits tidy mappings

Adding the point layer with .data$newABUNDANCE and .data$analysis is consistent with the top-level mapping.


271-273: LGTM: condition plot aesthetics migrated correctly

Errorbar/point mappings via .data are correct.

R/utils_groupcomparison_plots.R (4)

191-196: Tidy-eval migration is correct; ensure rlang::.data is imported

Nice use of .data[[log_adjp]] for dynamic column. Make sure the package imports rlang’s .data (see verification script in my other comment).


212-212: LGTM: text label mapping updated

geom_text_repel(..., aes(label = .data$Protein)) is correct.


229-229: LGTM: dynamic y mapping in guide/threshold lines

Using .data[[log_adjp]] across all threshold/guide layers keeps things consistent.

Also applies to: 251-251, 257-257, 262-262


291-293: LGTM: comparison plot aesthetics migrated; verify Label ordering

Tidy-eval for Label/logFC/ciw is correct. Please confirm input$Label is factor-ordered as intended so the x-axis order matches expectations.

R/groupComparisonQCPlots.R (2)

124-124: LGTM: QQ plot uses .data pronoun correctly

aes(sample = .data$residual) is the right tidy-eval form. Ensure rlang’s .data is imported (see repo-wide check script).


175-176: LGTM: residual plot aesthetics migrated

aes(x = .data$fitted, y = .data$residual) bound to sub.residuals.table is correct.

Comment on lines 59 to 60
profile_plot = ggplot(input, aes(x = .data$RUN, y = .data$newABUNDANCE,
color = .data[[type_color]], linetype = .data$FEATURE)) +
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

🧩 Analysis chain

Import rlang::.data and minor consistency nit

  • You switched to tidy-eval correctly. Ensure rlang’s .data pronoun is imported, otherwise R CMD check will warn/fail.
  • Optional: use explicit data = input for consistency with other calls.

Apply this minimal tweak for consistency:

-profile_plot = ggplot(input, aes(x = .data$RUN, y = .data$newABUNDANCE,
+profile_plot = ggplot(data = input, aes(x = .data$RUN, y = .data$newABUNDANCE,
                                   color = .data[[type_color]], linetype = .data$FEATURE)) +

To wire imports via roxygen (outside these lines), add once in a package R file:

#' @importFrom rlang .data
NULL

Run the script below to verify:

Also applies to: 66-66


🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo "Check roxygen import tag:"
rg -n '@importFrom\s+rlang\s+\.data' -S R || echo "MISSING: add @importFrom rlang .data"
echo "Check NAMESPACE for import:"
rg -n 'importFrom\(rlang,\s*\.data\)' NAMESPACE || echo "MISSING: NAMESPACE importFrom(rlang,.data)"
echo "Check DESCRIPTION for rlang in Imports/Depends:"
rg -nP '^(Imports|Depends):' -nC2 DESCRIPTION | rg -n 'rlang' || echo "MISSING: add rlang to Imports"
echo "Any remaining aes_string?:"
rg -n 'aes_string\(' -S R || true

Length of output: 661


Import rlang::.data and add ggplot data argument

  • Add explicit data = input to ggplot calls in R/utils_dataprocess_plots.R (lines 59–60 and 66):
-profile_plot = ggplot(input, aes(x = .data$RUN, y = .data$newABUNDANCE,
+profile_plot = ggplot(data = input, aes(x = .data$RUN, y = .data$newABUNDANCE,
                                   color = .data[[type_color]], linetype = .data$FEATURE)) +
  • Add a single roxygen import (e.g., in R/zzz.R or any package R file):
#' @importFrom rlang .data
NULL
  • Regenerate NAMESPACE and ensure DESCRIPTION lists rlang in Imports (run devtools::document() or roxygen2::roxygenize()), then re-run R CMD check.

Verification: script output → @importFrom rlang .data missing; NAMESPACE importFrom missing; DESCRIPTION missing rlang; no aes_string found.

🤖 Prompt for AI Agents
In R/utils_dataprocess_plots.R around lines 59–60 (and also update the ggplot
call at line 66), the ggplot call is missing an explicit data = input and uses
.data without ensuring rlang is imported; update both ggplot calls to include
data = input, add a roxygen import line for rlang::.data (for example in
R/zzz.R: a roxygen @importFrom rlang .data directive followed by NULL), add
rlang to DESCRIPTION Imports, then regenerate NAMESPACE (run
devtools::document() or roxygen2::roxygenize()) and re-run R CMD check to ensure
@importFrom rlang .data, NAMESPACE importFrom, and DESCRIPTION import are
present and no aes_string remains.

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: 2

♻️ Duplicate comments (6)
R/utils_dataprocess_plots.R (3)

59-63: Tidy-eval migration looks good; consider explicit data arg and verify linewidth support.

  • Optional: prefer data = input for consistency with other calls.
  • Verify ggplot2 (>= 3.4.0) since you’re using linewidth; otherwise switch to size.

Apply minimal tweaks if you don’t bump ggplot2:

-profile_plot = ggplot(input, aes(x = .data$RUN, y = .data$newABUNDANCE,
+profile_plot = ggplot(data = input, aes(x = .data$RUN, y = .data$newABUNDANCE,
                                            color = .data[[type_color]], linetype = .data$FEATURE)) +
-        geom_line(linewidth = 0.5)
+        geom_line(size = 0.5)

Run to verify imports/versions:

#!/bin/bash
set -euo pipefail
echo "Check rlang::.data roxygen import:"
rg -n '@importFrom\s+rlang\s+\.data' -S R || echo "MISSING: add @importFrom rlang .data"
echo "Check NAMESPACE for import:"
rg -n 'importFrom\(rlang,\s*\.data\)' NAMESPACE || echo "MISSING: NAMESPACE importFrom(rlang,.data)"
echo "Check DESCRIPTION imports:"
rg -nP '^(Imports|Depends):' -nC2 DESCRIPTION | rg -n 'rlang' || echo "MISSING: add rlang to Imports"
echo "Check ggplot2 minimal version:"
rg -n '^Imports:' -nC3 DESCRIPTION | rg -n 'ggplot2' && rg -n 'ggplot2\s*\(>=\s*3\.4\.0\)' DESCRIPTION || echo "Consider: require ggplot2 (>= 3.4.0) or replace linewidth with size"
echo "Any remaining aes_string?:"
rg -n 'aes_string\(' -S R || true

159-164: LGTM; confirm linewidth compatibility.


286-286: Verify linewidth support or use size.

R/utils_groupcomparison_plots.R (3)

192-196: LGTM on aes() + .data migration.

Ensure rlang::.data is imported via roxygen/NAMESPACE (see script in prior comment).


229-237: LGTM; tidy-eval for dynamic y works. Validate linewidth support.


302-302: Verify linewidth or swap to size for broader compatibility.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d6b1c3f and 97e7e18.

📒 Files selected for processing (2)
  • R/utils_dataprocess_plots.R (8 hunks)
  • R/utils_groupcomparison_plots.R (7 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
🔇 Additional comments (12)
R/utils_dataprocess_plots.R (7)

100-100: LGTM.


194-194: LGTM.


212-214: LGTM.


237-239: LGTM.


247-247: LGTM.


271-273: LGTM; good tidy-eval conversion.


291-291: LGTM.

R/utils_groupcomparison_plots.R (5)

213-213: LGTM.


251-254: LGTM.


256-259: LGTM.


261-264: LGTM.


291-293: LGTM.

if (is_censored) {
profile_plot = profile_plot +
geom_point(aes_string(x = "RUN", y = "newABUNDANCE", color = type_color, shape = "censored"),
geom_point(aes(x = .data$RUN, y = .data$newABUNDANCE, color = .data[[type_color]], shape = .data$censored),
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Bug: shape mapped to nonexistent column (censored) — use is_censored to match data prep.

You factorize input$is_censored above but map shape = .data$censored. Align the aesthetic to avoid empty shapes.

Apply:

-        geom_point(aes(x = .data$RUN, y = .data$newABUNDANCE, color = .data[[type_color]], shape = .data$censored),
+        geom_point(aes(x = .data$RUN, y = .data$newABUNDANCE, color = .data[[type_color]], shape = .data$is_censored),
                    data = input,
                    size = dot.size.profile) +
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
geom_point(aes(x = .data$RUN, y = .data$newABUNDANCE, color = .data[[type_color]], shape = .data$censored),
geom_point(aes(x = .data$RUN, y = .data$newABUNDANCE, color = .data[[type_color]], shape = .data$is_censored),
data = input,
size = dot.size.profile) +
🤖 Prompt for AI Agents
In R/utils_dataprocess_plots.R around line 66, the geom_point maps shape =
.data$censored which doesn't exist (the data uses is_censored); change the
aesthetic to shape = .data$is_censored so it references the factorized variable
from data prep (and update any corresponding scale_shape_* calls or legend
titles to use is_censored if present).

Comment on lines +168 to 175
aes(x = .data$RUN, y = .data$newABUNDANCE,
color = .data$analysis, size = .data$analysis,
shape = .data$censored)) +
geom_point(data = input[input$PEPTIDE == "Run summary"],
aes_string(x = "RUN", y = "newABUNDANCE",
color = "analysis", size = "analysis",
shape = "censored")) +
aes(x = .data$RUN, y = .data$newABUNDANCE,
color = .data$analysis, size = .data$analysis,
shape = .data$censored)) +
scale_shape_manual(values = c(16, 1),
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Same shape/aesthetic mismatch here.

Map to is_censored in both point layers to match the available column.

Apply:

-            geom_point(data = input[input$PEPTIDE != "Run summary"], 
-                       aes(x = .data$RUN, y = .data$newABUNDANCE, 
-                                  color = .data$analysis, size = .data$analysis, 
-                                  shape = .data$censored)) +
+            geom_point(data = input[input$PEPTIDE != "Run summary"], 
+                       aes(x = .data$RUN, y = .data$newABUNDANCE, 
+                                  color = .data$analysis, size = .data$analysis, 
+                                  shape = .data$is_censored)) +
             geom_point(data = input[input$PEPTIDE == "Run summary"], 
-                       aes(x = .data$RUN, y = .data$newABUNDANCE, 
-                                  color = .data$analysis, size = .data$analysis, 
-                                  shape = .data$censored)) +
+                       aes(x = .data$RUN, y = .data$newABUNDANCE, 
+                                  color = .data$analysis, size = .data$analysis, 
+                                  shape = .data$is_censored)) +
🤖 Prompt for AI Agents
In R/utils_dataprocess_plots.R around lines 168 to 175, both geom_point layers
are mapping shape to .data$censored which doesn't exist; change the mapping to
.data$is_censored in both point layers (i.e., replace shape = .data$censored
with shape = .data$is_censored) and keep the existing scale_shape_manual so the
shape values align with the is_censored factor levels.

@tonywu1999 tonywu1999 changed the title fix(ggplot): Migrate from aes_string to aes for plotting functions fix(dataProcessPlots, groupComparisonPlots): Migrate away from deprecated functions for ggplot Sep 18, 2025
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: 0

♻️ Duplicate comments (2)
R/utils_dataprocess_plots.R (2)

66-66: Critical: Shape aesthetic references nonexistent column.

The geom_point() maps shape = .data$censored, but line 49 shows the column is named is_censored. This mismatch will cause plotting errors or missing shapes.

Apply this fix:

-        geom_point(aes(x = .data$RUN, y = .data$newABUNDANCE, color = .data[[type_color]], shape = .data$censored),
+        geom_point(aes(x = .data$RUN, y = .data$newABUNDANCE, color = .data[[type_color]], shape = .data$is_censored),
                    data = input,
                    size = dot.size.profile) +

168-174: Critical: Both geom_point layers reference nonexistent column.

Both geom_point() calls map shape = .data$censored, but the data column is is_censored (see line 49 in .makeProfilePlot). This will cause plotting errors.

Apply this fix:

             geom_point(data = input[input$PEPTIDE != "Run summary"], 
-                       aes(x = .data$RUN, y = .data$newABUNDANCE, 
-                                  color = .data$analysis, size = .data$analysis, 
-                                  shape = .data$censored)) +
+                       aes(x = .data$RUN, y = .data$newABUNDANCE, 
+                                  color = .data$analysis, size = .data$analysis, 
+                                  shape = .data$is_censored)) +
             geom_point(data = input[input$PEPTIDE == "Run summary"], 
-                       aes(x = .data$RUN, y = .data$newABUNDANCE, 
-                                  color = .data$analysis, size = .data$analysis, 
-                                  shape = .data$censored)) +
+                       aes(x = .data$RUN, y = .data$newABUNDANCE, 
+                                  color = .data$analysis, size = .data$analysis, 
+                                  shape = .data$is_censored)) +
🧹 Nitpick comments (1)
R/utils_dataprocess_plots.R (1)

237-237: Optional: Add explicit data argument for consistency.

While ggplot(input, aes(...)) is valid, other updated calls in this file use the explicit data = input form. Consider applying for consistency:

-    ggplot(input, aes(x = .data$RUN, y = .data$ABUNDANCE)) +
+    ggplot(data = input, aes(x = .data$RUN, y = .data$ABUNDANCE)) +
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 97e7e18 and 3bf94cc.

📒 Files selected for processing (4)
  • DESCRIPTION (2 hunks)
  • NAMESPACE (1 hunks)
  • R/msstats-package.R (1 hunks)
  • R/utils_dataprocess_plots.R (8 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
🔇 Additional comments (15)
R/msstats-package.R (1)

4-4: LGTM: rlang import enables tidy evaluation.

The @importFrom rlang .data directive correctly imports the .data pronoun, which is essential for the tidy evaluation pattern used throughout the updated plotting code.

NAMESPACE (1)

109-109: LGTM: Generated import for .data pronoun.

This NAMESPACE entry is correctly generated from the @importFrom rlang .data roxygen directive and enables tidy evaluation across the package.

DESCRIPTION (2)

40-41: LGTM: rlang dependency added appropriately.

Adding rlang to Imports is necessary to support the .data pronoun used in the modernized ggplot2 code throughout the package.


57-57: LGTM: Standard RoxygenNote version bump.

The RoxygenNote version update reflects the regeneration of package documentation and NAMESPACE.

R/utils_dataprocess_plots.R (11)

59-60: LGTM: Clean migration to tidy evaluation.

The ggplot call correctly uses data = input with .data pronouns and .data[[type_color]] for the dynamic column reference. This eliminates the deprecated aes_string().


62-62: LGTM: Correct migration from size to linewidth.

Switching to linewidth = 0.5 for geom_line() resolves the ggplot2 deprecation warning about using size for line width.


100-100: LGTM: geom_text correctly uses .data pronouns.

The text layer aesthetics properly reference columns via .data$RUN, .data$ABUNDANCE, and .data$Name.


158-163: LGTM: Summary plot correctly migrated to tidy evaluation.

The ggplot call uses explicit data = input with .data pronouns for all aesthetics, and geom_line() correctly uses linewidth instead of the deprecated size.


194-194: LGTM: geom_text correctly uses .data pronouns.

The text layer aesthetics properly reference columns via .data pronouns.


212-213: LGTM: geom_point correctly uses .data pronouns.

The point layer aesthetics properly reference columns via .data$RUN, .data$newABUNDANCE, and .data$analysis.


239-239: LGTM: geom_boxplot correctly uses .data pronoun.

The fill aesthetic properly references the column via .data$LABEL.


247-247: LGTM: geom_text correctly uses .data pronouns.

The text layer aesthetics properly reference columns via .data pronouns.


271-271: LGTM: ggplot correctly uses .data pronouns with explicit data.

The aesthetics properly use .data$Label and .data$Mean. The data = input argument is present (though placed after aes, which is valid R syntax).


272-272: LGTM: geom_errorbar correctly uses .data pronouns.

The error bar aesthetics properly reference columns via .data$Mean and .data$ciw.


286-286: LGTM: geom_hline correctly uses linewidth.

Switching to linewidth = 0.6 resolves the ggplot2 deprecation warning about using size for line width.

@tonywu1999 tonywu1999 merged commit 64058e3 into devel Sep 30, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants