Skip to content

add checkboxes for dose response curves for log transformation and increasing assumption#153

Merged
tonywu1999 merged 4 commits intodevelfrom
feat-log-axis
Feb 10, 2026
Merged

add checkboxes for dose response curves for log transformation and increasing assumption#153
tonywu1999 merged 4 commits intodevelfrom
feat-log-axis

Conversation

@tonywu1999
Copy link
Copy Markdown
Contributor

@tonywu1999 tonywu1999 commented Feb 10, 2026

Summary by CodeRabbit

  • New Features
    • Added adjustable plot height slider for customized visualization sizing.
    • Introduced configurable response curve fitting options including logarithmic x-axis transformation and increasing trend specification.
    • Enhanced plot output rendering with improved UI architecture.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

This change introduces new namespace constants for response-curve fitting options and plot visualization controls, refactors plot rendering from insertUI to renderUI, and converts hardcoded fitting parameters (log x-axis and increasing trend flags) to dynamic user-controlled inputs driven by UI elements.

Changes

Cohort / File(s) Summary
Constants & Namespace
R/constants.R
Added five new public namespace keys: modeling_response_curve_fitting_options, modeling_response_curve_increasing_trend, modeling_response_curve_log_xaxis, visualization_plot_output, and visualization_plot_height_slider.
Server Logic & Helpers
R/module-statmodel-server.R
Introduced get_response_curve_fitting_options() helper function; refactored plot rendering from insertUI to renderUI with centralized output handling; updated dose-response fitting to read dynamic user inputs for log x-axis and increasing trend flags instead of hardcoded values; added plot height slider integration.
Modeling UI Options
R/statmodel-ui-options-modeling.R
Added UI placeholder for response-curve fitting options; introduced two new checkbox UI helper functions (create_response_curve_log_xaxis_checkbox() and create_response_curve_increasing_trend_checkbox()) with tooltip support.
Results UI
R/statmodel-ui-results.R
Updated plot output ID reference from literal string "comparison_plots" to namespaced constant NAMESPACE_STATMODEL$visualization_plot_output.
Utilities
R/utils.R
Modified fitResponseCurves call to read increasing and transform_dose parameters from user inputs via namespace constants instead of hardcoded boolean values.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • sszvetecz

Poem

🐰 A hop through constants, new and bright,
Log axes, trends—now user's might!
From hardcoded flags to choices free,
The response curve dances, wild and spry!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary changes: adding checkboxes for dose response curves with log transformation and increasing trend options.
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 unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat-log-axis

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.

@github-actions
Copy link
Copy Markdown

Failed to generate code suggestions for PR

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.

Caution

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

⚠️ Outside diff range comments (1)
R/module-statmodel-server.R (1)

433-449: ⚠️ Potential issue | 🟡 Minor

Provide a fallback default for the height parameter in groupComparisonPlots calls.

The height slider is conditionally rendered only when plot_type == Heatmap (line 843–844), and even then it doesn't exist on the first render. For Volcano and ComparisonPlot types, the slider never exists. This means input[[NAMESPACE_STATMODEL$visualization_plot_height_slider]] will be NULL in both cases. While MSstats::groupComparisonPlots has a default height = 600, passing NULL explicitly does not trigger that default and will likely cause an error.

Apply the fix to both line 433 and line 449:

Proposed fix
-        height = input[[NAMESPACE_STATMODEL$visualization_plot_height_slider]],
+        height = input[[NAMESPACE_STATMODEL$visualization_plot_height_slider]] %||% 500,

(Using %||% from rlang, or if (!is.null(...)) ... else 500 if rlang is unavailable)

🧹 Nitpick comments (3)
R/statmodel-ui-options-modeling.R (1)

17-17: Stale comment — the feature it requests is now implemented by this PR.

The comment # need option for increasing or decreasing trend for dose response describes exactly what this PR adds. Consider removing it.

Proposed fix
-    # need option for increasing or decreasing trend for dose response
R/module-statmodel-server.R (2)

797-848: Nested render* inside renderUI — functional but worth noting the trade-offs.

Creating renderPlot/renderPlotly outputs inside renderUI (lines 802, 814, 829) produces anonymous outputs. This works in Shiny, but has a caveat: every time the renderUI re-evaluates (e.g., when visualization_view_results changes), the anonymous outputs are destroyed and recreated, losing any client-side state.

Two additional notes on this block:

  1. Line 810: matrix <- contrast$matrix shadows base::matrix. Not a bug here but a readability concern — consider renaming to e.g. contrast_mat.

  2. Line 819: ratio_response = TRUE in visualizeResponseProtein, while fitResponseCurves (utils.R:1313) uses ratio_response = FALSE. If these are intentionally different (fitting vs. visualization), a brief comment explaining why would help future maintainers.


836-847: Height slider is created inside the same renderUI that reads its value.

The slider for heatmap height is emitted as part of the renderUI output, but the plot (output_plot) already read input[[visualization_plot_height_slider]] during this same render pass. On the very first render the slider doesn't exist yet so height is NULL. Once the slider appears, changes to it will re-trigger renderPlotly (since it's a reactive dependency inside the render function), so subsequent interactions work fine — it's only the initial render that gets NULL.

If you want the slider to drive height from the start, consider placing the sliderInput in a separate renderUI or in the static UI, rather than co-locating it with the plot output.

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