Skill Tracer
Skills › Scientific Agent Skills › cellxgene-census › census_schema.md

census_schema.md

225 lines · skills/cellxgene-census/references/census_schema.md at 5f2bc03

Open on GitHub
1# CZ CELLxGENE Census Data Schema Reference
2

CZ CELLxGENE Census Data Schema Reference

Raw lines 1 to 2
3## Overview
4
5The CZ CELLxGENE Census is a versioned collection of single-cell and spatial transcriptomics data built on the TileDB-SOMA framework. This reference documents the data structure, available metadata fields, and query syntax.
6
7Current reference point:
8- Package examples target `cellxgene-census==1.18.0`
9- Current stable LTS Census: `2025-11-08`
10- Census schema version: `2.4.0`
11- CELLxGENE dataset schema version: `7.0.0`
12- SDK tested against this LTS: `cellxgene-census` 1.18.0 / TileDB-SOMA 2.3.0
13- Sources: [official schema](https://github.com/chanzuckerberg/cellxgene-census/blob/main/docs/cellxgene_census_schema.md) and [release notes](https://chanzuckerberg.github.io/cellxgene-census/cellxgene_census_docsite_data_release_info.html), reviewed 2026-09-30.

Overview

The CZ CELLxGENE Census is a versioned collection of single-cell and spatial transcriptomics data built on the TileDB-SOMA framework. This reference documents the data structure, available metadata fields, and query syntax.

Current reference point:

  • Package examples target cellxgene-census==1.18.0
  • Current stable LTS Census: 2025-11-08
  • Census schema version: 2.4.0
  • CELLxGENE dataset schema version: 7.0.0
  • SDK tested against this LTS: cellxgene-census 1.18.0 / TileDB-SOMA 2.3.0
  • Sources: official schema and release notes, reviewed 2026-09-30.
Raw lines 3 to 14
15## High-Level Structure
17The Census is organized as a `SOMACollection` with these main components:

High-Level Structure

The Census is organized as a SOMACollection with these main components:

Raw lines 15 to 18
19### 1. census_info
20Summary information including:
21- **summary**: Build date, cell counts, dataset statistics
22- **datasets**: Source datasets included in this release (not all of Discover); fields include `dataset_id`, `dataset_version_id`, `dataset_title`, `collection_id`, `collection_name`, `collection_doi`, `citation`, `dataset_h5ad_path`, and `dataset_total_cell_count`. Disease and tissue live on `obs`, not this table.
23- **organisms**: `organism`, `organism_label`, and `organism_ontology_term_id` mappings
24- **summary_cell_counts**: Cell counts stratified by metadata categories

1. census_info

Summary information including:

  • summary: Build date, cell counts, dataset statistics
  • datasets: Source datasets included in this release (not all of Discover); fields include dataset_id, dataset_version_id, dataset_title, collection_id, collection_name, collection_doi, citation, dataset_h5ad_path, and dataset_total_cell_count. Disease and tissue live on obs, not this table.
  • organisms: organism, organism_label, and organism_ontology_term_id mappings
  • summary_cell_counts: Cell counts stratified by metadata categories
Raw lines 19 to 25
26### 2. census_data
27Organism-specific `SOMAExperiment` objects:
28- **"homo_sapiens"**: Human single-cell data
29- **"mus_musculus"**: Mouse single-cell data
30- **"callithrix_jacchus"**: Common marmoset single-cell data
31- **"macaca_mulatta"**: Rhesus macaque single-cell data
32- **"pan_troglodytes"**: Chimpanzee single-cell data

2. census_data

Organism-specific SOMAExperiment objects:

  • "homo_sapiens": Human single-cell data
  • "mus_musculus": Mouse single-cell data
  • "callithrix_jacchus": Common marmoset single-cell data
  • "macaca_mulatta": Rhesus macaque single-cell data
  • "pan_troglodytes": Chimpanzee single-cell data
Raw lines 26 to 33
34### 3. census_spatial_sequencing
35Spatial organism-specific `SOMAExperiment` objects for supported releases. Spatial and non-spatial data share core metadata requirements, while spatial observations also include spatial columns such as `array_col`, `array_row`, and `in_tissue`.

3. census_spatial_sequencing

Spatial organism-specific SOMAExperiment objects for supported releases. Spatial and non-spatial data share core metadata requirements, while spatial observations also include spatial columns such as array_col, array_row, and in_tissue.

Raw lines 34 to 36
37## Single-Cell Data Structure Per Organism
39Each organism experiment contains:

Single-Cell Data Structure Per Organism

Each organism experiment contains:

Raw lines 37 to 40
41### obs (Cell Metadata)
42Cell-level annotations stored as a `SOMADataFrame`. Access via:
43```python
44census["census_data"]["homo_sapiens"].obs
45```

obs (Cell Metadata)

Cell-level annotations stored as a SOMADataFrame. Access via:

census["census_data"]["homo_sapiens"].obs
Raw lines 41 to 46
47### ms["RNA"] (Measurement)
48RNA measurement data including:
49- **X**: Data matrices with layers:
50 - `raw`: Raw count data
51 - `normalized`: Library-size-normalized values; full-gene assays also receive gene-length normalization. This is not log-transformed. Inspect `list(experiment.ms["RNA"].X)` for the selected release. Spatial data provides `raw` only.
52- **var**: Gene metadata
53- **feature_dataset_presence_matrix**: Sparse boolean array showing which genes were measured in each dataset

ms["RNA"] (Measurement)

RNA measurement data including:

  • X: Data matrices with layers:
  • raw: Raw count data
  • normalized: Library-size-normalized values; full-gene assays also receive gene-length normalization. This is not log-transformed. Inspect list(experiment.ms["RNA"].X) for the selected release. Spatial data provides raw only.
  • var: Gene metadata
  • feature_dataset_presence_matrix: Sparse boolean array showing which genes were measured in each dataset
Raw lines 47 to 54
55## Spatial Data Structure Per Organism
57Spatial data is stored separately from the single-cell Census data:
58```python
59census["census_spatial_sequencing"]["homo_sapiens"]
60```
62Each spatial organism experiment contains:
63- `obs`: Spatial observation metadata, including core Census metadata and spatial fields such as `array_col`, `array_row`, and `in_tissue`
64- `ms["RNA"]`: RNA measurement matrices and feature metadata
65- `spatial[scene_id].obsl["loc"]`: point-cloud positions for each scene, with `x`, `y`, and `soma_joinid`
67Use `axis_query(...).to_spatialdata(X_name="raw")` when exporting a spatial slice to `spatialdata`.

Spatial Data Structure Per Organism

Spatial data is stored separately from the single-cell Census data:

census["census_spatial_sequencing"]["homo_sapiens"]

Each spatial organism experiment contains:

  • obs: Spatial observation metadata, including core Census metadata and spatial fields such as array_col, array_row, and in_tissue
  • ms["RNA"]: RNA measurement matrices and feature metadata
  • spatial[scene_id].obsl["loc"]: point-cloud positions for each scene, with x, y, and soma_joinid

Use axis_query(...).to_spatialdata(X_name="raw") when exporting a spatial slice to spatialdata.

Raw lines 55 to 68
69## Cell Metadata Fields (obs)

Cell Metadata Fields (obs)

Raw lines 69 to 70
71### Required/Core Fields
73**Identity & Dataset:**
74- `soma_joinid`: Unique integer identifier for joins
75- `dataset_id`: Source dataset identifier
76- `is_primary_data`: Boolean flag (True = primary representation, False = duplicate across datasets)
78**Cell Type:**
79- `cell_type`: Human-readable cell type name
80- `cell_type_ontology_term_id`: Standardized ontology term (e.g., "CL:0000236")
82**Tissue:**
83- `tissue`: Specific tissue name
84- `tissue_general`: Broader tissue category (useful for grouping)
85- `tissue_ontology_term_id`: Standardized ontology term
86- `tissue_general_ontology_term_id`: Standardized ontology term for the broader tissue category
88**Assay:**
89- `assay`: Sequencing technology used
90- `assay_ontology_term_id`: Standardized ontology term
92**Disease:**
93- `disease`: Disease status or condition
94- `disease_ontology_term_id`: Standardized ontology term
96**Donor:**
97- `donor_id`: Source-provided donor identifier; do not assume global uniqueness across studies
98- `sex`: Biological sex (male, female, unknown)
99- `self_reported_ethnicity`: Ethnicity information
100- `development_stage`: Life stage (adult, child, embryonic, etc.)
101- `development_stage_ontology_term_id`: Standardized ontology term
103**Organism:**
104Select the experiment by its organism key. Organism labels/ontology IDs are in
105`census_info["organisms"]`, not guaranteed `obs` columns.
107**Technical:**
108- `suspension_type`: Sample preparation type (cell, nucleus, na)
109- `tissue_type`: `tissue` or `organoid` for included observations
110- `observation_joinid`: Source observation identity
111- `nnz`, `n_measured_vars`, `raw_sum`, `raw_mean_nnz`, `raw_variance_nnz`: Count summaries; the `_nnz` statistics exclude zeros

Required/Core Fields

Identity & Dataset:

  • soma_joinid: Unique integer identifier for joins
  • dataset_id: Source dataset identifier
  • is_primary_data: Boolean flag (True = primary representation, False = duplicate across datasets)

Cell Type:

  • cell_type: Human-readable cell type name
  • cell_type_ontology_term_id: Standardized ontology term (e.g., "CL:0000236")

Tissue:

  • tissue: Specific tissue name
  • tissue_general: Broader tissue category (useful for grouping)
  • tissue_ontology_term_id: Standardized ontology term
  • tissue_general_ontology_term_id: Standardized ontology term for the broader tissue category

Assay:

  • assay: Sequencing technology used
  • assay_ontology_term_id: Standardized ontology term

Disease:

  • disease: Disease status or condition
  • disease_ontology_term_id: Standardized ontology term

Donor:

  • donor_id: Source-provided donor identifier; do not assume global uniqueness across studies
  • sex: Biological sex (male, female, unknown)
  • self_reported_ethnicity: Ethnicity information
  • development_stage: Life stage (adult, child, embryonic, etc.)
  • development_stage_ontology_term_id: Standardized ontology term

Organism: Select the experiment by its organism key. Organism labels/ontology IDs are in census_info["organisms"], not guaranteed obs columns.

Technical:

  • suspension_type: Sample preparation type (cell, nucleus, na)
  • tissue_type: tissue or organoid for included observations
  • observation_joinid: Source observation identity
  • nnz, n_measured_vars, raw_sum, raw_mean_nnz, raw_variance_nnz: Count summaries; the _nnz statistics exclude zeros
Raw lines 71 to 112
113## Gene Metadata Fields (var)
115Access via:
116```python
117census["census_data"]["homo_sapiens"].ms["RNA"].var
118```
120**Available Fields:**
121- `soma_joinid`: Unique integer identifier for joins
122- `feature_id`: Ensembl gene ID (e.g., "ENSG00000161798")
123- `feature_name`: Gene symbol (e.g., "FOXP2"); duplicates are allowed since schema 2.4.0, so use `feature_id` as the stable feature key
124- `feature_type`: Present in the verified 2025-11-08 build, although omitted from the upstream schema field list; inspect the live schema
125- `feature_length`: Gene length in base pairs
126- `nnz`: Non-zero count summary
127- `n_measured_obs`: Number of measured observations for the feature

Gene Metadata Fields (var)

Access via:

census["census_data"]["homo_sapiens"].ms["RNA"].var

Available Fields:

  • soma_joinid: Unique integer identifier for joins
  • feature_id: Ensembl gene ID (e.g., "ENSG00000161798")
  • feature_name: Gene symbol (e.g., "FOXP2"); duplicates are allowed since schema 2.4.0, so use feature_id as the stable feature key
  • feature_type: Present in the verified 2025-11-08 build, although omitted from the upstream schema field list; inspect the live schema
  • feature_length: Gene length in base pairs
  • nnz: Non-zero count summary
  • n_measured_obs: Number of measured observations for the feature
Raw lines 113 to 128
129## Value Filter Syntax
131Queries use Python-like expressions for filtering. The syntax is processed by TileDB-SOMA.

Value Filter Syntax

Queries use Python-like expressions for filtering. The syntax is processed by TileDB-SOMA.

Raw lines 129 to 132
133### Comparison Operators
134- `==`: Equal to
135- `!=`: Not equal to
136- `<`, `>`, `<=`, `>=`: Numeric comparisons
137- `in`: Membership test (e.g., `feature_id in ['ENSG00000161798', 'ENSG00000188229']`)

Comparison Operators

  • ==: Equal to
  • !=: Not equal to
  • <, >, <=, >=: Numeric comparisons
  • in: Membership test (e.g., feature_id in ['ENSG00000161798', 'ENSG00000188229'])
Raw lines 133 to 138
139### Logical Operators
140- `and`, `&`: Logical AND
141- `or`, `|`: Logical OR

Logical Operators

  • and, &: Logical AND
  • or, |: Logical OR
Raw lines 139 to 142
143### Examples
145**Single condition:**
146```python
147value_filter="cell_type == 'B cell'"
148```
150**Multiple conditions with AND:**
151```python
152value_filter="cell_type == 'B cell' and tissue_general == 'lung' and is_primary_data == True"
153```
155**Using IN for multiple values:**
156```python
157value_filter="tissue in ['lung', 'liver', 'kidney']"
158```
160**Complex condition:**
161```python
162value_filter="(cell_type == 'neuron' or cell_type == 'astrocyte') and disease != 'normal'"
163```
165**Filtering genes:**
166```python
167var_value_filter="feature_name in ['CD4', 'CD8A', 'CD19']"
168```

Examples

Single condition:

value_filter="cell_type == 'B cell'"

Multiple conditions with AND:

value_filter="cell_type == 'B cell' and tissue_general == 'lung' and is_primary_data == True"

Using IN for multiple values:

value_filter="tissue in ['lung', 'liver', 'kidney']"

Complex condition:

value_filter="(cell_type == 'neuron' or cell_type == 'astrocyte') and disease != 'normal'"

Filtering genes:

var_value_filter="feature_name in ['CD4', 'CD8A', 'CD19']"
Raw lines 143 to 169
170### Multi-Value Disease Fields
172In current LTS releases, `disease` and `disease_ontology_term_id` may contain multiple values delimited by ` || `. Exact equality filters such as `disease == 'COVID-19'` can miss cells whose disease field contains multiple labels. For comprehensive disease queries, first inspect available values with `get_obs()` or `summary_cell_counts`, then choose filters that match the selected release's encoding.

Multi-Value Disease Fields

In current LTS releases, disease and disease_ontology_term_id may contain multiple values delimited by || . Exact equality filters such as disease == 'COVID-19' can miss cells whose disease field contains multiple labels. For comprehensive disease queries, first inspect available values with get_obs() or summary_cell_counts, then choose filters that match the selected release's encoding.

Raw lines 170 to 173
174## Data Inclusion Criteria
176The Census includes all data from CZ CELLxGENE Discover meeting:
1781. **Species**: Supported human, mouse, marmoset, rhesus macaque, and chimpanzee data; inspect the selected release's organism table and collections
1792. **Technology**: Approved sequencing technologies for RNA
1803. **Count Type**: Raw counts only (no processed/normalized-only data)
1814. **Metadata**: Standardized following CELLxGENE schema
1825. **Sample type**: Tissue and organoid observations; primary cell culture is excluded
1836. **Both spatial and non-spatial data**: Includes qualifying assays, with spatial data stored separately

Data Inclusion Criteria

The Census includes all data from CZ CELLxGENE Discover meeting:

  1. Species: Supported human, mouse, marmoset, rhesus macaque, and chimpanzee data; inspect the selected release's organism table and collections
  2. Technology: Approved sequencing technologies for RNA
  3. Count Type: Raw counts only (no processed/normalized-only data)
  4. Metadata: Standardized following CELLxGENE schema
  5. Sample type: Tissue and organoid observations; primary cell culture is excluded
  6. Both spatial and non-spatial data: Includes qualifying assays, with spatial data stored separately
Raw lines 174 to 184
185## Important Data Characteristics

Important Data Characteristics

Raw lines 185 to 186
187### Duplicate Cells
188Cells may appear across multiple datasets. Use `is_primary_data == True` to filter for unique cells in most analyses.

Duplicate Cells

Cells may appear across multiple datasets. Use is_primary_data == True to filter for unique cells in most analyses.

Raw lines 187 to 189
190### Count Types
191The Census includes:
192- **Molecule counts**: From UMI-based methods
193- **Full-gene sequencing read counts**: From non-UMI methods
194These may need different normalization approaches.

Count Types

The Census includes:

  • Molecule counts: From UMI-based methods
  • Full-gene sequencing read counts: From non-UMI methods

These may need different normalization approaches.

Raw lines 190 to 195
196### Versioning
197Census releases are versioned (e.g., "2025-11-08", "stable", "latest"). Always specify an LTS build date for reproducible analysis:
198```python
199census = cellxgene_census.open_soma(census_version="2025-11-08")
200```
202`stable` resolves to the current LTS release. `latest` resolves to the newest weekly release, which provides fast access to newly ingested datasets but is retained for a shorter period than LTS releases.

Versioning

Census releases are versioned (e.g., "2025-11-08", "stable", "latest"). Always specify an LTS build date for reproducible analysis:

census = cellxgene_census.open_soma(census_version="2025-11-08")

stable resolves to the current LTS release. latest resolves to the newest weekly release, which provides fast access to newly ingested datasets but is retained for a shorter period than LTS releases.

Raw lines 196 to 203
204## Feature Dataset Presence Matrix
206Access which genes were measured in each dataset:
207```python
208presence_matrix = census["census_data"]["homo_sapiens"].ms["RNA"]["feature_dataset_presence_matrix"]
209```
211This sparse boolean matrix helps understand:
212- Gene coverage across datasets
213- Which datasets to include for specific gene analyses
214- Technical batch effects related to gene coverage

Feature Dataset Presence Matrix

Access which genes were measured in each dataset:

presence_matrix = census["census_data"]["homo_sapiens"].ms["RNA"]["feature_dataset_presence_matrix"]

This sparse boolean matrix helps understand:

  • Gene coverage across datasets
  • Which datasets to include for specific gene analyses
  • Technical batch effects related to gene coverage
Raw lines 204 to 215
216## SOMA Object Types
218Core TileDB-SOMA objects used:
219- **DataFrame**: Tabular data (obs, var)
220- **SparseNDArray**: Sparse matrices (X layers, presence matrix)
221- **DenseNDArray**: Dense arrays (less common)
222- **Collection**: Container for related objects
223- **Experiment**: Top-level container for measurements
224- **SOMAScene**: Spatial transcriptomics scenes
225- **obs_spatial_presence**: A DataFrame mapping observations to scenes, not a separate SOMA object type

SOMA Object Types

Core TileDB-SOMA objects used:

  • DataFrame: Tabular data (obs, var)
  • SparseNDArray: Sparse matrices (X layers, presence matrix)
  • DenseNDArray: Dense arrays (less common)
  • Collection: Container for related objects
  • Experiment: Top-level container for measurements
  • SOMAScene: Spatial transcriptomics scenes
  • obs_spatial_presence: A DataFrame mapping observations to scenes, not a separate SOMA object type
Raw lines 216 to 225