census-large / README.md
jan-eforest's picture
Clarify chunk selection and downsampling
13ac627 verified
|
Raw History Blame Contribute Delete
4.23 kB
---
license: cc-by-4.0
pretty_name: "census-large: balanced human scRNA-seq corpus from CELLxGENE Census"
size_categories:
- 1M<n<10M
tags:
- biology
- single-cell
- scRNA-seq
- transcriptomics
- cellxgene
- autoencoder
- autoencodix
---
# census-large
A balanced human single-cell RNA-seq corpus derived from the
[CZ CELLxGENE Census](https://chanzuckerberg.github.io/cellxgene-census/). It was used to tune, train and evaluate
the large pretrained AUTOENCODIX models (Ontix, Varix, Disentanglix), which are available in the
[autoencodix model collection](https://huggingface.co/autoencodix).
- Code to create the corpus: [ACX_largemodel_reproducibility](https://github.com/jan-forest/ACX_largemodel_reproducibility)
(`src/01_get_census_data.py`, `src/02_census_preparation.py`)
- Extended results (evaluation tables, holdout latent embeddings, plots): [Zenodo](https://doi.org/10.5281/zenodo.24396083)
- Python package: [autoencodix](https://github.com/jan-forest/autoencodix_package) ([PyPI](https://pypi.org/project/autoencodix/))
## Corpus creation
- Source: CELLxGENE Census LTS release `2025-11-08`, *Homo sapiens*.
- Balancing: cells were grouped into chunks, one per unique combination of
cell type × tissue × sex (male, female, unknown) × disease state (normal, diseased).
Only combinations with more than 1,000 cells in the Census were kept, which left 4,158 chunks
(649 cell types, 68 tissues). Within each chunk, cells with fewer than 5% expressed genes were removed, and the chunk
was then randomly downsampled to at most 1,000 cells (on average about 900 cells per chunk).
- Expression values are `log1p` transformed and cover 16,375 genes (Ensembl IDs in `var`, symbols in
`var["feature_name"]`).
- The joined corpus was randomly split into 90% train, 5% tune (hyperparameter optimisation) and 5% holdout
(evaluation).
## Files
| Split | AnnData | AUTOENCODIX container | Cells (container splits) | Used for |
|---|---|---|---|---|
| train | `census_train_split.h5ad` | `census-acxcontainer_train.pkl` | 3,364,463 (3,330,818 train / 16,822 valid / 16,823 test) | Final model training |
| tune | `census_tune_split.h5ad` | `census-acxcontainer_tune.pkl` | 177,077 (106,246 train / 63,747 valid / 7,084 test) | Hyperparameter tuning |
| holdout | `census_holdout_split.h5ad` | `census-acxcontainer_holdout.pkl` | 186,396 | Evaluation, xAI, data generation |
Each split is provided in two formats with the same content:
- **`*.h5ad`**: standard [AnnData](https://anndata.readthedocs.io/) files. `obs` contains the Census cell annotations
(e.g. `cell_type`, `tissue`, `tissue_general`, `disease`, `sex`, `development_stage`), the derived annotations
`high_level_stage_name` and `is_diseased`, and 25 cell-type classification tasks (`Task1_Monocytes` …
`Task25_Secretory-Epithelium`) used for downstream evaluation.
- **`*.pkl`**: AUTOENCODIX data containers with fixed train/valid/test assignments, exactly as used in the experiments.
Loading them requires `autoencodix==0.2.4`.
## Usage
```python
from huggingface_hub import hf_hub_download
import anndata as ad
path = hf_hub_download("autoencodix/census-large", "census_holdout_split.h5ad", repo_type="dataset")
adata = ad.read_h5ad(path) # use backed="r" for the large train split
```
```python
import pickle
from huggingface_hub import hf_hub_download
path = hf_hub_download("autoencodix/census-large", "census-acxcontainer_holdout.pkl", repo_type="dataset")
with open(path, "rb") as f:
acx_container = pickle.load(f) # requires autoencodix==0.2.4
```
The containers are pickle files. Only load pickle files from sources you trust.
## License and attribution
The data are derived from the CZ CELLxGENE Discover / Census corpus. Datasets in CELLxGENE are published under
CC BY 4.0. Please cite the CELLxGENE Discover publication and the original datasets (`obs["dataset_id"]`) together
with the AUTOENCODIX publication.
- CZI Cell Science Program et al. *CZ CELLxGENE Discover: a single-cell data platform for scalable exploration,
analysis and modeling of aggregated data.* Nucleic Acids Research 53(D1):D886–D900 (2025).
- AUTOENCODIX publication: citation will be added when the preprint is available.