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/scripts/singleCellSignalsPeaks/makeSingleCellSignalsPeaksRa.py src/hg/makeDb/scripts/singleCellSignalsPeaks/makeSingleCellSignalsPeaksRa.py
index bbb36c5f61c..cf33e174d10 100755
--- src/hg/makeDb/scripts/singleCellSignalsPeaks/makeSingleCellSignalsPeaksRa.py
+++ src/hg/makeDb/scripts/singleCellSignalsPeaks/makeSingleCellSignalsPeaksRa.py
@@ -65,30 +65,35 @@
     build = os.path.dirname(os.path.dirname(os.path.abspath(stanzas)))
     meta = args.meta or os.path.join(build, "meta", "%s.metadata.tsv" % asm)
     out = args.out or os.path.join(
         os.path.dirname(os.path.abspath(__file__)),
         "../../trackDb/%s/%s/%s.ra" % (ORG[asm], asm, TRACK))
 
     header = "\n".join([
         "track " + TRACK,
         "compositeTrack faceted",
         "group " + GROUP,
         "visibility hide",
         "type bigBed 3",
         "shortLabel Single-cell ATAC-seq",
         "longLabel Single-cell ATAC-seq Peaks and Signals for UCSC Cell Browser datasets",
         "metaDataUrl %s/%s_metadata.tsv" % (gbdb, TRACK),
+        # Cell class -> color for the facet swatches in the selector, so a class reads the
+        # same in the checkbox list as in the drawn tracks (both come from
+        # celltype-crosswalks/celltype-palette.tsv). Written by
+        # copySingleCellSignalsPeaksFiles.py alongside the facet metadata.
+        "colorSettingsUrl %s/%s_colors.json" % (gbdb, TRACK),
         "primaryKey Track",
         "subtrackUrls Dataset=https://cells.ucsc.edu/?ds=$$",
         "defaultSortField Cell_class",
         "maxCheckboxes 200",
         # One scale across every selected subtrack, so two tracks drawn at the same locus
         # can be compared directly; with per-track autoScale, tracks whose values differ
         # by orders of magnitude both drew full height. It must sit on the composite, not
         # the children: hgTracks groups by tdb->parent (wigTrack.c setMinMax), and a
         # per-subtrack setting would override this one. Limits are taken from the data in
         # the current window, not genome-wide, so an outlying region elsewhere in the
         # genome cannot flatten the view.
         "autoScale group",
     ])
 
     # class ordering for subtrack priority: palette line order (neurons, glia,