fix(comparisonPlot): Add 95% CI description in tooltip#202
Conversation
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
R/utils_groupcomparison_plots.R (1)
284-296: Tooltip CI label addition looks good.The new
sigparameter andci_labelintegration are clean and consistent with the documented family-wise confidence level (ciwat the call site uses a Bonferroni-corrected quantileqt(1 - sig/(2n), DF), so the(1-sig)*100% CIlabel correctly reflects the joint confidence level — matching the existing@param sigdescription ingroupComparisonPlots.Rline 12).One optional nit: since
ci_labelis a constant per plot, you could also surface it in a subtitle/caption (e.g.,labs(subtitle = ci_label)) so the CI level is visible in the static ggplot output (PDF), not only in the plotly tooltip. Feel free to ignore if the tooltip-only surfacing is intentional.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@R/utils_groupcomparison_plots.R` around lines 284 - 296, The plot currently only shows the CI level in the interactive tooltip; add the constant ci_label to the static ggplot output so PDF/PNG exports show the CI too by adding it to plot labels (e.g., use labs(subtitle = ci_label) or labs(caption = ci_label)) in the .makeComparison function after the ggplot/geom layers so the CI text appears on the static plot as well as in the tooltip.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@R/utils_groupcomparison_plots.R`:
- Around line 284-296: The plot currently only shows the CI level in the
interactive tooltip; add the constant ci_label to the static ggplot output so
PDF/PNG exports show the CI too by adding it to plot labels (e.g., use
labs(subtitle = ci_label) or labs(caption = ci_label)) in the .makeComparison
function after the ggplot/geom layers so the CI text appears on the static plot
as well as in the tooltip.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 99661923-7928-4d28-861d-bb818fbf01e4
📒 Files selected for processing (3)
R/groupComparisonPlots.RR/utils_groupcomparison_plots.Rman/dot-makeComparison.Rd
PR Type
Bug fix, Documentation
Description
Pass
siginto comparison plot helperShow CI percent in tooltips
Document
sig-driven CI behaviorDiagram Walkthrough
File Walkthrough
groupComparisonPlots.R
Forward significance level to plot helperR/groupComparisonPlots.R
siginto.makeComparisonutils_groupcomparison_plots.R
Add dynamic confidence interval tooltip labelR/utils_groupcomparison_plots.R
sigparameter to.makeComparisonsigdot-makeComparison.Rd
Document significance argument for comparison plotsman/dot-makeComparison.Rd
sigto.makeComparisonusagesigMotivation and Context
This PR enhances the user interface of the comparison plot by providing clearer information about the confidence interval (CI) level displayed in interactive tooltips. When users hover over data points in a comparison plot, the tooltip now explicitly indicates what confidence level (e.g., 95% CI) is being visualized, removing ambiguity about the statistical measure being presented.
Summary of Changes
Parameter Flow: The
sigparameter (FDR/significance cutoff) is now forwarded from thegroupComparisonPlotsfunction through to the internal.makeComparisonhelper function, enabling access to the significance level during plot construction.Confidence Interval Label Generation: The
.makeComparisonfunction now computes a formattedci_labelstring as"(X% CI)"where X is calculated as(1 - sig) × 100. With the defaultsig = 0.05, this produces"(95% CI)".Tooltip Enhancement: The point tooltip text in the comparison plot (via
geom_pointaesthetic) is updated to append the confidence interval label after the existing log fold change and confidence interval width values, resulting in tooltips like:"logFC: 1.2345 ± 0.6789 (95% CI)".Documentation Update: The
.makeComparisonfunction's Roxygen documentation is updated to document the newsigparameter, clarifying that it sets the significance level for computing and displaying the100(1-sig)%confidence interval in the comparison plot.Files Modified
R/groupComparisonPlots.R: Passessigparameter to.makeComparisoninvocation (lines 423-425)R/utils_groupcomparison_plots.R: Addssigparameter to function signature and implementsci_labelcreation and tooltip integration (lines 284-296)man/dot-makeComparison.Rd: Documents the newsigparameter and its role in confidence interval calculationUnit Tests
No unit tests are included in this PR to verify the tooltip text generation or the confidence interval label formatting. Existing test suites (test_groupComparison.R, test_groupComparisonQCPlots.R) do not contain tests that would validate this tooltip enhancement.