feat: cap the UMI degree distribution axis at 40 and summarize outliers - #97
Closed
ludvigla wants to merge 1 commit into
Closed
feat: cap the UMI degree distribution axis at 40 and summarize outliers#97ludvigla wants to merge 1 commit into
ludvigla wants to merge 1 commit into
Conversation
Add a UMI degree distribution plot to component_node_degree(). The degree axis is capped at degree_cap (40 by default) so that extreme outliers do not compress the distribution, and samples with degrees above the cap get a text box stating the number of UMIs above the cap and the max degree. Co-authored-by: ludvigla <ludvigla@users.noreply.github.com>
ludvigla
marked this pull request as ready for review
August 17, 2026 07:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The UMI degree distribution is always strongly skewed: degree 1 is the most common value, counts decline rapidly, and everything above roughly 30 is an outlier. A single extreme outlier stretches the degree axis so far that the informative part of the distribution collapses into the left edge of the panel.
component_node_degree()now builds a degree distribution plot (degree_distribution_plot) fromes_data$qc$degree_distributionwhere:degree_cap(40 by default) withcoord_cartesian(), so out-of-range points are hidden without being dropped from the underlying data,The plot is added alongside the existing mean node degree violin and table, so
component$plotandcomponent$tableare unchanged. When no degree distribution data is available (older QC files, failed QC load)degree_distribution_plotisNULL. Pooled data (poolinstead ofsample_alias) is handled the same way as incomponent_denoising().Note that the built-in Quarto report does not currently call
component_node_degree(), so this only changes what the component returns; no report child document was modified.Rendered with the degree distributions from the bundled QC test data (which contain degrees up to 49):
UMI degree distribution capped at 40 with outlier text box
Fixes: #(issue number)
Type of change
How Has This Been Tested?
R CMD checkpasses on ubuntu, macos and windows,lintpasses, and the Docker CI test job passes. The package test suite (including the new assertions) therefore runs against the reales_datafixtures for both the default and the hashing test data.tests/testthat/test_components.R:component_node_degree()returns a buildabledegree_distribution_plot, returnsNULLfor it whenqc$degree_distributionis missing, the degree axis stays capped when an extreme outlier is present, the text box appears only when there are outliers and reports the right UMI count and maximum degree,degree_capis configurable, and pooled input is accepted.umi1/umi2degree distributions ininst/extdata/qc_jsons/collapse/to check the layout of the text box (screenshot above).PR checklist:
To show artifacts inline, enable in settings.