Skip to content

Deprecate showClusterDendrogram(); remove create_cluster_dendrogram() - #152

Merged
jiajic merged 3 commits into
gsourcefrom
refactor/retire-cluster-dendrogram
Oct 1, 2026
Merged

jiajic merged 3 commits into
gsourcefrom
refactor/retire-cluster-dendrogram

Conversation

@jiajic

@jiajic jiajic commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

showClusterDendrogram() builds and draws a cluster dendrogram. Giotto::calculateClusterTree() now builds that tree better, and other functions depend on its output:

  • One tree for everything: it's the tree that getDendrogramSplits(), findNodeMarkers(), writeClusterTreeQuery() and annotateClusterTree() all use.
  • It gets clusters in the right order: it orders cluster labels naturally before correlating. That's what stops near-tied ward splits from coming out differently (3 of 35 on the Atera object).
  • One pass: the per-cluster means come from a single grouped featStats pass.
  • Views: it takes view = (Giotto#1320).

showClusterDendrogram() builds its own tree, without the ordering guarantee, so its figure can disagree with the splits, markers and annotations. Given a tree, it amounts to ggdendro::ggdendrogram(tree). plot(tree) does the same in base graphics, and plotClusterTree() draws the annotated version.

Changes

  • showClusterDendrogram(): soft-deprecated. It warns with "was deprecated in GiottoVisuals 0.2.16. Please use Giotto::calculateClusterTree() instead. Plot the returned tree with plot() or ggdendro::ggdendrogram()." It keeps working until it's removed, because 7 website tutorials call it.
  • tree = removed from showClusterDendrogram(). It came in with feat: showClusterDendrogram(tree = ) #146 and has only been on gsource, so the unreleased NEWS bullet that announced it is removed too.
  • create_cluster_dendrogram(): removed. Its only caller was showClusterDendrogram(), and its few lines (dcast → cor → hclust → ggdendrogram) are now inline there. GiottoVisuals can't route through calculateClusterTree() itself, because Giotto depends on GiottoVisuals, not the reverse.
  • Docs: plotClusterTree()'s @seealso no longer points to the deprecated function.

Verification

  • Same plot as before: showClusterDendrogram()'s ggplot_build() layers are identical to the pre-change build on the visium mini, with h = included.
  • Deprecation: the warning fires with the message above.
  • Removals: create_cluster_dendrogram is no longer exported, and tree is gone from the formals.
  • Test suite: 38 tests, 84 expectations, all passing. Nothing in the tests referenced either function.

Follow-ups

  • plotClusterTree(): a labels = NULL default, so it can draw an unannotated tree and become the in-suite ggplot replacement. It'll also gain view = for its cell-count track. Both are planned with a giottoTree subclass in Giotto that records the view a tree was built under.
  • Website: the 7 tutorials should move to calculateClusterTree() + plot() / plotClusterTree().

🤖 Generated with Claude Code

…ndrogram()

Giotto::calculateClusterTree() builds the tree the splits, node markers and
annotations use; plot that instead. Drops the dev-only tree = argument.
labels is optional, tree is second, and cluster_column / units / view for the
size track default to the tree's. Leaves are checked against the data.
Renames plot_dendrogram.R to plot_cluster_tree.R.
…ults

plotClusterTree(gobject, tree): defaults from a giottoTree
@jiajic
jiajic merged commit 5954d4a into gsource Oct 1, 2026
0 of 6 checks passed
@jiajic
jiajic deleted the refactor/retire-cluster-dendrogram branch October 1, 2026 14:42
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