Skip to content

Updated MoleculeRankPlot#144

Merged
ludvigla merged 7 commits into
mainfrom
pna-2283
Jun 23, 2026
Merged

Updated MoleculeRankPlot#144
ludvigla merged 7 commits into
mainfrom
pna-2283

Conversation

@ludvigla

Copy link
Copy Markdown
Collaborator

Description

This PR updates MoleculeRankPlot to enable:

  • highlight min/max size filter (horizontal dashed lines)
  • highlight numbers of cells per size category: Low, Normal, High
  • add "rug" density distribution
  • split plots by group_by column

Fixes: PNA-2283

Type of change

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).
  • This change requires a documentation update.

How Has This Been Tested?

Updated tests in tests/testthat/test-MoleculeRankPlot.R

PR checklist:

  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have documented any significant changes to the code in CHANGELOG.md

@ludvigla ludvigla requested review from Copilot and maxkarlsson June 22, 2026 11:55
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.23810% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.37%. Comparing base (9be38ba) to head (4c990aa).

Files with missing lines Patch % Lines
R/molecule_rank_plot.R 95.14% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #144      +/-   ##
==========================================
+ Coverage   80.20%   80.37%   +0.16%     
==========================================
  Files          56       56              
  Lines        8296     8392      +96     
==========================================
+ Hits         6654     6745      +91     
- Misses       1642     1647       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances MoleculeRankPlot to support additional QC annotations (min/max threshold lines, category cell counts, rug distribution) and optional faceting by a group_by column, with corresponding documentation and tests.

Changes:

  • Added new MoleculeRankPlot parameters: n_umi_min_threshold, n_umi_max_threshold, highlight_cell_counts, rug, and split (faceting).
  • Extended type-check utilities to allow assert_within_limits(..., allow_null = TRUE) for optional numeric inputs.
  • Updated docs, NAMESPACE imports (ggplot2 geom_rug), tests, and CHANGELOG entry.

Reviewed changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
R/molecule_rank_plot.R Implements new plot features, input validation, faceting, rug, and cell-count annotations.
R/types_check.R Adds allow_null support to assert_within_limits() to validate optional numeric thresholds.
R/generics.R Updates MoleculeRankPlot roxygen docs for new parameters/behavior.
R/pixelatorR-package.R Adds roxygen import for ggplot2::geom_rug.
NAMESPACE Imports geom_rug from ggplot2.
man/type_check_helpers.Rd Regenerates docs reflecting the updated assert_within_limits() signature.
man/MoleculeRankPlot.Rd Regenerates docs reflecting new MoleculeRankPlot arguments and updated examples.
tests/testthat/test-MoleculeRankPlot.R Adds tests covering new arguments and split/facet behavior.
CHANGELOG.md Notes the new MoleculeRankPlot capabilities.
Files not reviewed (2)
  • man/MoleculeRankPlot.Rd: Generated file
  • man/type_check_helpers.Rd: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/molecule_rank_plot.R
Comment thread R/molecule_rank_plot.R
Comment thread R/molecule_rank_plot.R Outdated
Comment thread R/molecule_rank_plot.R
Comment thread R/molecule_rank_plot.R
Comment thread man/MoleculeRankPlot.Rd

@maxkarlsson maxkarlsson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good! Found 1 potential bug and had two comments.

Comment thread R/molecule_rank_plot.R Outdated
Comment thread R/molecule_rank_plot.R Outdated
}

if (highlight_cell_counts) {
min_y <- max(n_umi_min_threshold - 0.2 * n_umi_min_threshold, 0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We could make it simpler and just set this to n_umi_min_threshold and use vjust to control positioning (?)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah that works too, but I felt it was more boiler plate code because I had to add multiple geom_text layer. I made some AI-powered improvements which should be more robust.

Comment thread R/molecule_rank_plot.R Outdated
@ludvigla ludvigla merged commit 490e663 into main Jun 23, 2026
7 checks passed
@ludvigla ludvigla deleted the pna-2283 branch June 23, 2026 07:39
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.

4 participants