Repository navigation
Fix getCirclize self-links and clonalHomeostasis group ordering (v2.9.2) - #583
Merged
Merged
Conversation
#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.
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
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.
Two bug fixes reported via GitHub issues, plus a patch version bump to 2.9.2.
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 onn > 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 = TRUEpath, which had the identical over-counting bug.The clonal groups sorted alphabetically (
Hyperexpanded, Large, Medium, Rare, Small) instead of by proportion bin, placingRarebeforeSmall.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 theclone.sizebins, so custom bins stay correct.combineExpression()already ordered itscloneSizefactor this way, so no change was needed there.Changes
R/getCircilize.R— add n > 0 guard to self-link subtraction and n.sharedR/clonalHomeostasis.R— order fill categories by proportion binNEWS.md— 2.9.2 bug-fix entriesDESCRIPTION— version bump to 2.9.2