550a0e2666bcce27181a0cb0eab32ed261e444f6
mspeir
  Thu Aug 27 14:56:42 2026 -0700
singleCellSignalsPeaks: color the Cell class facet checkboxes, refs #37820, refs #37914

The faceted UI already draws a color swatch beside each checkbox of any facet
named in a colorSettingsUrl JSON, and the track already colors its subtracks by
broad cell class from celltype-palette.tsv. Publish that palette so the selector
shows the same colors: copySingleCellSignalsPeaksFiles.py now writes
<bed>/singleCellSignalsPeaks_colors.json alongside the facet metadata, and the
composite header names it. Rendered from the one shared palette, so a class is
the same color in the checkbox list, in the drawn tracks, and on both assemblies.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

diff --git src/hg/makeDb/doc/hg38/singleCellSignalsPeaks.txt src/hg/makeDb/doc/hg38/singleCellSignalsPeaks.txt
index 34dac1a5c5f..ca007866604 100644
--- src/hg/makeDb/doc/hg38/singleCellSignalsPeaks.txt
+++ src/hg/makeDb/doc/hg38/singleCellSignalsPeaks.txt
@@ -64,37 +64,44 @@
 # Subtrack colors and labels carry through from the hub stanzas.
 #
 # Colors are the shared broad-cell-class palette, NOT each dataset's own scheme --
 # SEA-AD used to come through in its own subclass colors, and no longer does, so a
 # cell class is one color across every dataset and both assemblies. See
 # doc/mm10/singleCellSignalsPeaks.txt sections 4 and 4b.
 #
 #   scriptDir=$HOME/kent/src/hg/makeDb/scripts/singleCellSignalsPeaks
 #   python3 $scriptDir/makeSingleCellSignalsPeaksRa.py \
 #       --stanzas $CBHUB_OUT/stanzas/hg38.trackDb.txt \
 #       --out $HOME/kent/src/hg/makeDb/trackDb/human/hg38/singleCellSignalsPeaks.ra
 #
 # https://github.com/ucscGenomeBrowser/kent/tree/master/src/hg/makeDb/scripts/singleCellSignalsPeaks
 
 ##############################################################################
-# 4. Facet metadata
+# 4. Facet metadata and facet colors
 ##############################################################################
 # The faceted composite's metaDataUrl points at a copy of the hub's hg38
 # main-faceted metadata (primaryKey = Track):
 #
 #   cp $CBHUB_OUT/meta/hg38.metadata.tsv \
 #      /hive/data/genomes/hg38/bed/singleCellSignalsPeaks/singleCellSignalsPeaks_metadata.tsv
+#
+# Its colorSettingsUrl points at singleCellSignalsPeaks_colors.json in the same dir,
+# which gives the faceted UI a color swatch for each Cell class checkbox, matching the
+# color the subtracks of that class are drawn in. Both files are written by
+# copySingleCellSignalsPeaksFiles.py (section 2); the JSON is rendered from the shared
+# celltype-palette.tsv, so it is identical on hg38 and mm10. See
+# doc/mm10/singleCellSignalsPeaks.txt section 2 for the format and its gotchas.
 
 ##############################################################################
 # 5. Labels, colors, and facets
 ##############################################################################
 # The cell type / cell class / shortLabel / longLabel / color / facet values are
 # all derived by build_stanzas.py, not copied from the source hubs. That logic
 # (paper-curated cell-type crosswalks, the shared broad-class color palette, the
 # rebuilt short and long labels, the variant descriptors that keep every label
 # unique, and the per-collection tissue/life-stage/condition parsing incl. SEA-AD
 # region + ADNC) is documented once in doc/mm10/singleCellSignalsPeaks.txt
 # section 4; it runs identically for hg38. Tracks are colored by broad cell class
 # from the same palette as mm10, so a class is the same color on both assemblies.
 #
 # hg38-specific label notes:
 #   - cortex-atac calls peaks three ways and serves all three for each cell type.