Repository navigation
Read categorical gene names from H5AD var - #21
Merged
Merged
Conversation
CELLxGENE files store /var/feature_name as a categorical group (codes + categories), which readGeneNames skipped, so files such as the Census Visium heart (fe5b3268-ddd8-415a-9432-f1f95bfdb500) listed every gene by its Ensembl ID and searching MYH7 or NPPA found nothing. readGeneNames now decodes categorical groups and legacy /var/__categories/<key> sidecars as well as string datasets, keeping the existing rules: the first column with one value per gene and at least one non-empty value wins, missing codes become var-N, and duplicates get -2, -3 suffixes. A legacy sidecar used to fail the whole load with "Expected H5AD /var/feature_name to contain strings." The obs readers share the new categorical helpers. The h5wasm, kerchunk-reference and SpatialData table backends all go through this path. When a column replaces the index, each gene's index name is kept as an alias (geneAliases). The Gene selection search and Gene set symbols match aliases, and the gene list tooltip shows them, so Ensembl IDs stay searchable. Selections, shared links and manifest defaults use the listed names only.
prete
added a commit
that referenced
this pull request
Nov 10, 2026
The heart H5AD stores gene symbols in a categorical /var/feature_name, which the viewer reads once #21 lands; until then the gene list shows Ensembl IDs and MYH7 matches no gene.
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CELLxGENE H5ADs store
/var/feature_nameas a categorical group (codes+categories,encoding-type"categorical").readGeneNamesonly accepted plain string datasets, so those files listed genes by the var index. The Census Visium adult heart (fe5b3268-ddd8-415a-9432-f1f95bfdb500, 32,397 genes, 32,381 categories) showed only ENSG IDs, and searching MYH7 or NPPA found nothing.readGeneNamesdecodes categorical groups and legacy/var/__categories/<key>sidecars as well as string datasets. The rules are unchanged: the first ofgene_symbols,gene_symbol,feature_name,namewith one value per gene and at least one non-empty value replaces the index, missing codes becomevar-N, and duplicates get-2,-3suffixes (16 genes in the heart file). A legacy sidecar used to fail the whole load ("Expected H5AD /var/feature_name to contain strings."). The obs readers now share the categorical helpers. The h5wasm, kerchunk-reference and SpatialData table backends all use this path.geneAliases()on the H5AD and SpatialData datasets,aliaseson the ready gene-panel state). TheGene selectionsearch andGene set symbolsmatch aliases, and the gene list tooltip shows them (MYH7 (ENSG00000092054)). Selections, shared links and manifestdefaults.genesuse the listed names only, so an older link withgenes=ENSG…no longer colours these files.docs/modalities/h5ad.md,docs/host-your-own-data.md,docs/ui-reference.md.Test plan
feature_nameas a group and as a legacy sidecar (h5wasm) and over a kerchunk reference; missing and duplicate codes; all-missing codes falling back to the index; index-only files having no aliases; alias search, gene-set parsing, tooltip, lifecycle plumbing. The categorical tests fail against the old reader.npm run lint,npm run typecheck,npx prettier --check .npm test. Two failures in the full run were unrelated: theApp.test.tsx50k-cell "all slide cells" test (timed out under load, passes alone) andhyparquetBitPacked.test.ts(that worktree'snode_modulespredated the hyparquet patch; passes afternpx patch-package).MYH7listed and selectable (2,571 positive of 4,992 spots, scale 0–4.55),ensg00000175206findsNPPA, no console errors.Follow-up: #20 can then default the heart example to
MYH7.