Skip to content

fix(volcano plot): Upgrade PTM volcano plots to be interactive via plotly#200

Merged
tonywu1999 merged 4 commits intodevelfrom
fix-ptm-2
Apr 24, 2026
Merged

fix(volcano plot): Upgrade PTM volcano plots to be interactive via plotly#200
tonywu1999 merged 4 commits intodevelfrom
fix-ptm-2

Conversation

@tonywu1999
Copy link
Copy Markdown
Contributor

@tonywu1999 tonywu1999 commented Apr 24, 2026

Motivation and Context

This PR fixes the PTM (Post-Translational Modification) visualization rendering to use interactive Plotly plots instead of static plots. Previously, PTM group comparison plots were rendered as static R plots, which limited user interaction and visualization capabilities. The fix enables Plotly-based rendering for PTM visualizations, providing a more interactive and user-friendly experience consistent with other plot types in the application.

Changes

R/module-statmodel-server.R

  • Changed the PTM comparison plot rendering from renderPlot() to renderPlotly() to produce interactive Plotly-based output
  • The plot content generation via create_group_comparison_plot(input, loadpage_input(), data_comparison()) remains unchanged
  • This ensures PTM visualizations render as interactive plots within the Shiny application

R/statmodel-server-visualization.R

  • Updated create_group_comparison_plot() function to handle PTM-specific plotting with Plotly support
  • Added isPlotly = TRUE parameter to the groupComparisonPlotsPTM() function call to enable Plotly output
  • Implemented conditional result selection logic: captures the full result object and selects result[[3]] when the result has at least 3 elements, otherwise falls back to result[[1]]
  • Added explicit NULL return statement in the error handler for cleaner error management

Unit Tests

No new unit tests were added or modified to specifically verify the Plotly rendering changes. The existing test in tests/testthat/test-utils-statmodel-server.R validates that PTM visualization code generation includes the groupComparisonPlotsPTM function call, but does not test the actual Plotly rendering behavior.

Coding Guidelines

No coding guideline violations identified. The changes follow R and Shiny conventions:

  • Proper use of Shiny rendering functions (renderPlotly)
  • Appropriate error handling with try-catch blocks
  • Consistent naming conventions and code structure with the rest of the codebase

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

Warning

Rate limit exceeded

@tonywu1999 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 40 minutes and 43 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 40 minutes and 43 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 573a5b61-f74d-483d-9b68-db944314b545

📥 Commits

Reviewing files that changed from the base of the PR and between 4915cac and fb05737.

📒 Files selected for processing (2)
  • R/module-statmodel-server.R
  • R/statmodel-server-visualization.R
📝 Walkthrough

Walkthrough

The pull request updates PTM visualization rendering from standard R plots to Plotly-based interactive plots. Changes involve switching the render function from renderPlot to renderPlotly and updating the underlying plotting logic to handle Plotly output with conditional result selection.

Changes

Cohort / File(s) Summary
PTM Visualization Rendering
R/module-statmodel-server.R
Changed renderer from renderPlot to renderPlotly to enable interactive Plotly-based visualization output.
PTM Plotting Logic
R/statmodel-server-visualization.R
Updated create_group_comparison_plot to capture full result from groupComparisonPlotsPTM, enable Plotly output via isPlotly = TRUE, conditionally select rendered object (result[[3]] or result[[1]]), and explicitly return NULL in error handler.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

Suggested labels

Review effort 1/5

Poem

🐰 A dash of Plotly magic fair,
Makes PTM plots dance in the air,
Interactivity blooms, so sleek,
Where once was static, now it speaks!
Hop along to this bright new way,
Visualizations rule the day!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.
Title check ✅ Passed The title accurately describes the main changes in the pull request: upgrading PTM volcano plots to use Plotly for interactivity, which aligns with the changes from renderPlot to renderPlotly and enabling Plotly output.

✏️ 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 fix-ptm-2

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.

@tonywu1999 tonywu1999 changed the title Fix ptm 2 fix(volcano plot): Upgrade PTM volcano plots to be interactive via plotly Apr 24, 2026
Copy link
Copy Markdown

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@R/statmodel-server-visualization.R`:
- Around line 86-97: The positional indexing using result[[3]] vs result[[1]] is
opaque—add a concise comment above the assignment to plot_result explaining that
groupComparisonPlotsPTM returns a list where element 3 is the adjusted peptide
plot (preferred) and element 1 is the unadjusted plot (fallback), so the code
chooses the adjusted plot when present; reference the symbols
groupComparisonPlotsPTM, result and plot_result in the comment to make the
contract explicit for future maintainers.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8cc3a9d2-8129-443f-a42d-f6ac3f5df9c7

📥 Commits

Reviewing files that changed from the base of the PR and between ccd22d3 and 4915cac.

📒 Files selected for processing (2)
  • R/module-statmodel-server.R
  • R/statmodel-server-visualization.R

Comment thread R/statmodel-server-visualization.R
@tonywu1999 tonywu1999 merged commit 700d5dd into devel Apr 24, 2026
1 of 2 checks passed
@tonywu1999 tonywu1999 deleted the fix-ptm-2 branch April 24, 2026 21:06
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