Skip to content

Fix getCirclize self-links and clonalHomeostasis group ordering (v2.9.2) - #583

Merged
ncborcherding merged 3 commits into
develfrom
bug-branch
Jul 9, 2026
Merged

ncborcherding merged 3 commits into
develfrom
bug-branch

Conversation

@ncborcherding

Copy link
Copy Markdown
Member

Two bug fixes reported via GitHub issues, plus a patch version bump to 2.9.2.

getCirclize(): self-links always returned 0 #582

With include.self = TRUE (the default), every diagonal (self) link came back as 0, regardless of how many private clones a group held.

The self-link value in symmetric mode is meant to be a group's private clone count:

value = (all clones in group) - (clones in group also seen in another group)

The clone table is built with table(), which materializes a zero-count row for every clone-by-group combination. The subtraction step that removes shared clones never filtered on n > 0, so every clone appeared to exist in every other group and the subtraction cancelled the entire count to 0.

Fix: require n > 0 in the subtraction so it only counts clones actually observed in other groups. Applied the same guard to the n.shared statistic in the include.metadata = TRUE path, which had the identical over-counting bug.

clonalHomeostasis(): clonal groups ordered alphabetically #581

The clonal groups sorted alphabetically (Hyperexpanded, Large, Medium, Rare, Small) instead of by proportion bin, placing Rare before Small.

The fill categories came out of reshape() as a plain character vector, which ggplot factorizes alphabetically.

Fix: cast the categories to a factor ordered by the proportion bins, so the legend and stacking follow Hyperexpanded → Large → Medium → Small → Rare. The ordering is derived from the clone.size bins, so custom bins stay correct. combineExpression() already ordered its cloneSize factor this way, so no change was needed there.

Changes

  • R/getCircilize.R — add n > 0 guard to self-link subtraction and n.shared
  • R/clonalHomeostasis.R — order fill categories by proportion bin
  • NEWS.md — 2.9.2 bug-fix entries
  • DESCRIPTION — version bump to 2.9.2

#582 Fix zero-valued self-links in getCirclize(include.self = TRUE)

The clone table from .cloneCounter() uses table(), which emits a zero-count row for every clone-by-group pair. The symmetric self-link branch subtracted shared clones without filtering n > 0, so every clone counted as shared and the diagonal always resolved to 0.

Add the n > 0 guard to the self-link subtraction so it only counts clones that actually appear in other groups. The diagonal now correctly reports private-clone counts. Applied the same guard to the n.shared calculation in the include.metadata path, which had the identical over-counting bug.
#581 The fill categories in clonalHomeostasis came out of reshape() as a
character vector, so ggplot sorted them alphabetically and produced
hyperexpanded-large-medium-rare-small. Cast category to a factor with
levels set to rev(varying_cols) so the legend and stack follow the
clone.size bins (Hyperexpanded to Rare). Ordering is derived from the
bins, so custom clone.size inputs stay correct.

combineExpression already ordered the cloneSize factor by bin via
rev(names(clone.size)), so no change was needed there.
Update documentation
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
R/getCircilize.R 50.00% 2 Missing ⚠️
Files with missing lines Coverage Δ
R/clonalHomeostasis.R 94.73% <100.00%> (+0.09%) ⬆️
R/getCircilize.R 38.46% <50.00%> (+0.53%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ncborcherding
ncborcherding merged commit e22b7f6 into devel Jul 9, 2026
2 of 3 checks passed
@ncborcherding
ncborcherding deleted the bug-branch branch July 9, 2026 18:29
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