Skip to content

Group by reads any of the dataset's sets for the plot alone - #168

Merged
prete merged 1 commit into
mainfrom
claude/plots-group-by-any-set
Nov 17, 2026
Merged

prete merged 1 commit into
mainfrom
claude/plots-group-by-any-set

Conversation

@prete

@prete prete commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Stacked on #166 (base claude/plots-selections-set). Review that one first; this diff is only the commit on top.

Problem

Group by listed only sets already in memory: the one loaded in Cells › Clusters, imported files, Save ROI classes and (from #166) Selections. To plot by another obs column you had to load it in Clusters, which replaces the map's set, drops imported labels and switches the cells to annotation colours.

Change

  • Group by has three parts, with Select now rendering consecutive options of the same group as an <optgroup>:
    • Loaded: sets loaded in Clusters, as before. They follow the legend's colours and hidden classes.
    • In the dataset: the dataset's other sets, from the same group list Clusters shows (plotDatasetSets). A set Clusters has loaded isn't listed twice. When Clusters loaded "All", none are listed.
    • Selections, from Plot each saved selection as a group (Group by › Selections) #166.
  • Choosing an "In the dataset" set reads its classes in the panel (useDatasetSetAnnotations, using the same loadActiveAnnotations loader Clusters uses). Colours are the dataset's stored ones, else the palette from its start (colorsForAnnotations(annotations, {})). The map, the legend and Clusters' set don't change. One set is kept at a time, and switching aborts a read in progress.
  • Loading the same set in Clusters afterwards moves the choice to the loaded set (resolvePlotSetId maps the read set's ID onto it).
  • Default when nothing is loaded and nothing is drawn: graphclust, else the first set with 2–60 classes, else the first with 2 or more. This skips single-value columns such as donor_id and per-cell ID columns such as observation_joinid.
  • A dataset set can't hide classes, so past the class limit the note suggests the heatmap or loading the set in Clusters.
  • Status and message cover reading a set ("Reading the classes of leiden…") and a failed read.
  • plotSetOptions and resolvePlotSetId now take one PlotSetSources object, and each option carries a kind.
  • The user guide and UI reference are updated.

Testing

  • plotsPanelModel.test.ts: dataset set listing and exclusion, default choice (graphclust, skipping 1-class and 4,992-class sets), waiting for and plotting a read set with stored and palette colours, the error state, and following the set into Clusters.
  • useDatasetSetAnnotations.test.tsx: one read per set, colours, aborting on a new choice, errors.
  • App.test.tsx: new test with an H5AD with two sets and nothing loaded. Plots reads the first set, lists both under "In the dataset", switches to the second, and the link gains neither groups= nor cellColor=annotations.
  • src/features/plots and src/components (226 tests) and src/App.test.tsx (92 tests) pass, plus lint, typecheck and Prettier.
  • In the app with Adult human heart (Visium):
    • With nothing loaded, the panel listed 25 dataset sets and defaulted to annotation_final (6 classes) in the dataset's colours, while the map stayed on MYH7 expression.
    • Loading annotation_final in Clusters moved it under "Loaded" and Plots followed it.
    • Choosing cell_type (27) in Plots left the map and legend on annotation_final.

Group by listed only sets already loaded in Cells › Clusters, and loading
one there replaces the map's set and recolours the cells. It now also
lists the dataset's other sets under "In the dataset"; choosing one reads
its classes inside the Plots panel, in their stored or palette colours,
leaving the map, the legend and Clusters' set as they are. Loading the
same set in Clusters moves the panel to the loaded set, which follows the
legend. With nothing loaded or drawn, the panel starts with graphclust or
the first set of 2 to 60 classes. Select gains optgroups for the headings.
@prete
prete changed the base branch from claude/plots-selections-set to main November 17, 2026 23:25
@prete
prete merged commit c82f29a into main Nov 17, 2026
4 checks passed
@prete
prete deleted the claude/plots-group-by-any-set branch November 17, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant