Cz cellxgene
Expert reference for pulling single-cell RNA data from CZ CELLxGENE — the cellxgene-census Python/R API (query, slice, and download cells across the whole harmonized corpus via TileDB-SOMA) and the CELLxGENE Discover Curation REST API (find and download published datasets/collections). Use whenever the user wants data from CELLxGENE / cziscience / cellxgene-census: opening the Census (open_soma), writing obs/var value_filters, building an AnnData with get_anndata, listing cell metadata, deduplicating with is_primary_data, loading hosted embeddings (scVI, Geneformer, UCE), downloading a source H5AD by dataset_id, or querying collections/datasets over REST. Also triggers on "cellxgene census", "cziscience", "get_anndata", "census_data", "下载 cellxgene 数据", "查询单细胞图谱". Gives correct API signatures, the exact obs/var schema and filter syntax (which models routinely get wrong), memory-safe query patterns, and version pinning for reproducibility.From its SKILL.md
npx -y skills add Agents365-ai/cz_cellxgeneAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
3 things to look at
- 27 days oldThe repository was created 27 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.3 KB, 830 tokens by cl100k_base, as published. Nobody here has run it
CZ CELLxGENE — Census API & Discover REST reference
Two distinct tools live under cellxgene.cziscience.com. Pick the right one:
| Goal | Tool | Reference |
|---|---|---|
| Query/slice cells across the whole corpus by cell type / tissue / disease, get an AnnData, load hosted embeddings | cellxgene-census (Python/R, TileDB-SOMA) | references/census-python-api.md |
Filter cells — which obs/var columns exist, valid values, value_filter syntax, raw vs normalized | schema | references/schema-and-filters.md |
| Find / download a published dataset or collection (one H5AD or RDS file), list collections programmatically | Discover Curation REST API | references/discover-rest-api.md |
| Ready-to-adapt end-to-end tasks | recipes | references/recipes.md |
| Avoid the common mistakes (version pinning, dedup, memory, filter syntax) | read this before writing a query | references/gotchas.md |
Notable atlas: Tabula Sapiens (human multi-organ reference, ~500K cells, DOI 10.1126/science.abl4896)
is already in the corpus as the Tabula Sapiens collection — get it via Census filter or Discover
download; see the Tabula Sapiens block in references/discover-rest-api.md.
Runnable helpers in scripts/:
census_query.py— open the Census, apply obs/var filters, write an.h5adslice.discover_download.py— stdlib-only; search collections/datasets over REST and download a dataset's H5AD by id.
When you're on a CELLxGENE task, do this
- Discover vs Census. "Download this specific published dataset/paper" → Discover REST (
discover-rest-api.md). "Get all cells matching a biological filter across datasets" → Census (census-python-api.md). - Before writing any
value_filter, confirm the column name and its categorical values againstreferences/schema-and-filters.md. Guessing a column liketissuevstissue_general, or a value like'lung'vs'lung parenchyma', silently returns 0 cells. - Always pin a Census version for reproducible results (
open_soma(census_version="2025-..."), not the moving"stable"), and addis_primary_data == Trueto avoid counting the same cell twice. Seegotchas.md. - Choose the X layer deliberately:
X_name="raw"for counts,X_name="normalized"for library-size-normalized values. There is no log layer — you log-transform yourself. - Copy the closest recipe from
references/recipes.mdand adapt it rather than writing from scratch.
Install
pip install -U cellxgene-census # pulls tiledbsoma, anndata
# R: install.packages("cellxgene.census", repos=c("https://chanzuckerberg.r-universe.dev","https://cloud.r-project.org"))
Access to the corpus is anonymous over public S3 — no account or key. Data is large and remote; queries stream from the cloud, so filter narrowly (see gotchas.md).
Authoritative docs (fetch when a signature is uncertain)
- Census docs home: https://chanzuckerberg.github.io/cellxgene-census/
- Python API reference: https://chanzuckerberg.github.io/cellxgene-census/python-api.html
- Discover docs: https://cellxgene.cziscience.com/docs
- Curation REST (OpenAPI/Swagger): https://api.cellxgene.cziscience.com/curation/ui/
What ships with it: 11 files
40.3 KB alongside SKILL.md, 2 of them executable
references/
- census-python-api.md6.3 KB
- discover-rest-api.md5.5 KB
- gotchas.md3.4 KB
- recipes.md5.0 KB
- schema-and-filters.md5.1 KB
scripts/
- census_query.pyruns2.8 KB
- discover_download.pyruns2.7 KB
- .gitignore108 B
- LICENSE1.3 KB
- README_CN.md4.1 KB
- README.md4.0 KB