Skip to content

fix(anomaly-metrics): Fix plotting x-axis for anomaly metrics#209

Merged
tonywu1999 merged 1 commit into
develfrom
fix-quality-plots
May 26, 2026
Merged

fix(anomaly-metrics): Fix plotting x-axis for anomaly metrics#209
tonywu1999 merged 1 commit into
develfrom
fix-quality-plots

Conversation

@tonywu1999
Copy link
Copy Markdown
Contributor

@tonywu1999 tonywu1999 commented May 26, 2026

PR Type

Bug fix, Documentation


Description

  • Use numeric run-order x-axis

  • Reduce clutter from long run names

  • Refresh generated documentation metadata


Diagram Walkthrough

flowchart LR
  A["Quality metrics data"]
  B["Run factor levels"]
  C["Numeric run positions"]
  D["Cleaner x-axis plot"]
  A -- "derive order from" --> B
  B -- "map runs to" --> C
  C -- "render as" --> D
Loading

File Walkthrough

Relevant files
Configuration changes
DESCRIPTION
Update roxygen configuration metadata                                       

DESCRIPTION

  • Adds Config/roxygen2/version: 8.0.0.
  • Updates package documentation-generation metadata.
+1/-1     
Bug fix
plot_quality_metrics.R
Plot metrics against numeric run order                                     

R/plot_quality_metrics.R

  • Documents numeric run-order positions on the x-axis.
  • Maps Run factor levels to RunOrder.
  • Uses continuous x-axis breaks every five runs.
  • Renames x-axis label to Run order.
+14/-9   
Documentation
utils_documentation.R
Refresh shared import documentation formatting                     

R/utils_documentation.R

  • Consolidates MSstatsConvert import documentation onto one line.
  • Keeps the same imported functions while refreshing roxygen formatting.
+1/-2     
MSstatsQualityMetricsPlot.Rd
Document numeric x-axis behavior                                                 

man/MSstatsQualityMetricsPlot.Rd

  • Updates details for the numeric run-order x-axis.
  • Explains run positions derive from Run factor levels.
  • Clarifies behavior with and without runOrder.
+6/-4     
reexports.Rd
Update generated reexport link syntax                                       

man/reexports.Rd

  • Updates MSstatsConvert reexport links to qualified Rd syntax.
  • Adds function-style link labels with parentheses.
+1/-1     

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Warning

Review limit reached

@tonywu1999, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 5 minutes and 55 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 52b5a193-8d72-4fba-9f33-944a80bda151

📥 Commits

Reviewing files that changed from the base of the PR and between 3fa0bd1 and 9071125.

📒 Files selected for processing (5)
  • DESCRIPTION
  • R/plot_quality_metrics.R
  • R/utils_documentation.R
  • man/MSstatsQualityMetricsPlot.Rd
  • man/reexports.Rd
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-quality-plots

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

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

Possible Issue

scale_x_continuous(breaks = seq(5, length(run_levels), by = 5)) fails when there are fewer than 5 run levels because seq(5, 1..4, by = 5) has the wrong step direction. This makes plotting error for small datasets instead of returning a plot. Consider guarding this case or generating breaks from 1 upward.

scale_x_continuous(breaks = seq(5, length(run_levels), by = 5)) +

@github-actions
Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Handle non-factor run columns

levels(input_df$Run) returns NULL when Run is not already a factor, causing RunOrder
to become all NA and the plot to fail or render incorrectly. Add a fallback that
matches the documented alphabetical ordering for non-factor runs.

R/plot_quality_metrics.R [103-104]

-run_levels <- levels(input_df$Run)
+run_levels <- if (is.factor(input_df$Run)) {
+    levels(input_df$Run)
+} else {
+    sort(unique(as.character(input_df$Run)))
+}
 plot_df$RunOrder <- match(as.character(plot_df$Run), run_levels)
Suggestion importance[1-10]: 8

__

Why: This correctly identifies that levels(input_df$Run) can be NULL for non-factor Run values, causing RunOrder to become NA and breaking or emptying the plot. The fallback to sorted unique run names matches the documented alphabetical behavior.

Medium
Fix small-run plotting failure

seq(5, length(run_levels), by = 5) errors when there are fewer than five runs
because the sequence direction conflicts with the positive step. Use a guarded break
calculation so small datasets still plot successfully.

R/plot_quality_metrics.R [113]

-scale_x_continuous(breaks = seq(5, length(run_levels), by = 5)) +
+scale_x_continuous(
+    breaks = if (length(run_levels) <= 5) {
+        seq_along(run_levels)
+    } else {
+        unique(c(1, seq(5, length(run_levels), by = 5)))
+    }
+) +
Suggestion importance[1-10]: 8

__

Why: This is a valid bug fix because seq(5, length(run_levels), by = 5) errors when there are fewer than five runs. The guarded break calculation preserves plotting for small datasets while keeping periodic breaks for larger ones.

Medium

@tonywu1999 tonywu1999 merged commit daf2409 into devel May 26, 2026
3 checks passed
@tonywu1999 tonywu1999 deleted the fix-quality-plots branch May 26, 2026 21:06
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.

1 participant