Skip to content

Figure 3 pairs: CITE-seq violins as one comparison, and R's labelled PBMC 3k UMAP - #138

Merged
shanikawm merged 3 commits into
mainfrom
docs/figure3-pairs
Sep 23, 2026
Merged

shanikawm merged 3 commits into
mainfrom
docs/figure3-pairs

Conversation

@shanikawm

Copy link
Copy Markdown
Contributor

Summary

The Frontiers revision shows Truecell's own tutorial figures in its Figure 3, and it asked for two of them to pair properly with R's (truecell_paper/Truecell_Revision1/TUTORIAL_CHANGES_2.0.0.md). Tutorial scripts, figures, tests and docs only: no package code changes, so no release. The paper will cite this PR's merge commit.

1. CITE-seq ADT-weight violins, drawn as one comparison (Reviewer 2, major comment 4). R's and Truecell's figure 10 used different group orders and colours. Now both scripts:

  • draw the cell types in one order, vln_plot's, from CELL_TYPES: every label annotate_cells can return;
  • colour each type from Seurat's hue_pal over all twelve labels, so the 69-cell DC / Mono cluster that only R's clustering finds moves no other colour. truecell.hue_pal(12) matches scales::hue_pal()(12) exactly, now pinned in test_plotting_theme.py;
  • draw no points, while the R script adds the median bar vln_plot draws, across each violin at its median;
  • use the same title and y-axis label.

R also writes r_10_adt_weight_by_celltype_manuscript.png, laid out at the 3.30 in the paper prints the panel at. Saved as the hand-off specified, with Seurat's default type sizes, it overprinted its y-axis labels and squashed the violins. So that copy uses the type sizes Truecell's panel prints at.

2. R's labelled PBMC 3k UMAP, r_11_umap_labeled.png. pbmc3k_verify.R drew no UMAP, so Figure 3A/B had no R panel from the same run. It now draws one, with the same title and size, and the cell types in Truecell's order. They are radix-sorted, because R's default sort under en_US.UTF-8 puts "Naive CD4 T" before "NK" and would have swapped two colours.

3. A comment in pbmc3k_tutorial.py still gave ARI 0.938; the measured value is 0.928.

Checks

  • Reports: the CITE-seq and PBMC 3k --reports are identical before and after. Every other R and Python figure regenerated byte-identical.
  • Guard: tests/test_multimodal_tutorial.py holds R's copy of CELL_TYPES to Python's, in vln_plot's order, as the set of labels both annotate_cells implementations can return. A behaviour test checks each violin's colour against its slot. All six mutations tried were caught: a reordered R list, a dropped label, a new label on either side, a palette over present types only, and points back on.
  • Layout: a new opt-in smoke test checks the violin figure's layout on the real data at full size, at 0.55 and at 3.30 in.
  • Suites: pytest tests/ gives 1734 passed, 30 skipped here; CI's counts will be read from its logs. The opt-in smoke tests -k "cbmc or labelled or cell_type" give 5 passed, including the new layout test, and the tree was clean after both.

🤖 Generated with Claude Code

shanikawm and others added 3 commits September 23, 2026 22:58
Reviewer 2 of the Frontiers paper (major comment 4) found R's and
Truecell's figure 10 in different orders and colours, which defeats the
side-by-side the paper prints as Figure 3C/D.

Both scripts now take the group order and colours from one list,
CELL_TYPES in cbmc_citeseq_tutorial.py: every label annotate_cells can
return, in vln_plot's order. Colours come from Seurat's hue_pal over all
twelve (truecell.hue_pal(12) matches scales::hue_pal()(12) exactly), so
the 69-cell DC / Mono cluster that only R's clustering finds moves no
other colour. Neither side draws points. The R script adds the median
bar vln_plot draws, across each violin at its median, and the titles
and y-axis labels match.

R also writes r_10_adt_weight_by_celltype_manuscript.png, laid out at
the 3.30 in the paper prints it, with the same 1350 x 750 pixels. Saved
with Seurat's default type sizes, that copy overprinted its y-axis
labels and squashed the violins, so its type is set to the sizes
Truecell's panel prints at.

Drawing only. The CITE-seq --report is identical before and after, and
every other R and Python figure regenerated byte-identical. The label
lists are guarded, and all six mutations tried were caught. The smoke
suite checks the figure's layout at full size, at 0.55 and at 3.30 in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pbmc3k_verify.R drew no UMAP, so the Frontiers paper's Figure 3A/B had
no R panel from the same run to set beside Truecell's
11_umap_labeled.png. It now saves r_11_umap_labeled.png: DimPlot with
labels, repelled, with the same title and size as Truecell's figure.

The cell types are levelled in Truecell's order. dim_plot sorts names by
code point, and a radix sort reproduces that in any locale, while R's
default sort under en_US.UTF-8 puts "Naive CD4 T" before "NK" and would
have swapped two colours. With the order matched, Seurat's default
hue_pal gives each type Truecell's colour.

Drawing only. The PBMC 3k --report is identical before and after, and
r_12_ridge_plot.png regenerated byte-identical. The tutorial page keeps
the published vignette's image on R's side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The resolution-sweep comment still gave the ARI documented before 2.0.0.
The measured and documented value at resolution 0.5 is 0.928, which the
tutorial page and README print. The remaining 0.938, at line 94, is the
history of that number and stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shanikawm
shanikawm merged commit 5dfdf29 into main Sep 23, 2026
8 checks passed
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