Install
$ agentstack add skill-alterlab-ieu-alterlab-academic-skills-alterlab-cellxgene ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
CZ CELLxGENE Census
Overview
The CZ CELLxGENE Census provides programmatic, versioned access to standardized single-cell genomics data from CZ CELLxGENE Discover. It contains 61+ million cells (human and mouse) with standardized metadata (cell types, tissues, diseases, donors), raw gene expression matrices, pre-calculated embeddings, and integration with PyTorch, scanpy, and other analysis tools.
When to Use This Skill
Use this skill when:
- Querying single-cell expression data by cell type, tissue, or disease
- Exploring available single-cell datasets and metadata
- Training machine learning models on single-cell data
- Performing large-scale cross-dataset analyses
- Integrating Census data with scanpy or other analysis frameworks
- Computing statistics across millions of cells
- Accessing pre-calculated embeddings or model predictions
For analyzing your own dataset (not the reference atlas), use scanpy or scvi-tools instead.
Installation
uv pip install cellxgene-census
# For PyTorch ML workflows (loaders moved out of cellxgene-census):
uv pip install tiledbsoma-ml
Core Workflow
- Open the Census with a context manager; pin
census_versionfor reproducibility. - Explore metadata first (
get_obs/ datasets summary) to understand what's available — always filteris_primary_data == Trueto avoid duplicate cells. - Estimate query size before loading expression. < 100k cells →
get_anndata()(in-memory); larger →axis_query()out-of-core iteration. - Query expression with
obs_value_filter(cells) andvar_value_filter(genes); select only theobs_column_namesyou need. - Downstream: hand the returned AnnData to scanpy, or stream batches into a PyTorch dataloader for ML.
Minimal skeleton:
import cellxgene_census
with cellxgene_census.open_soma(census_version="2023-07-25") as census:
adata = cellxgene_census.get_anndata(
census=census,
organism="Homo sapiens",
obs_value_filter="cell_type == 'B cell' and tissue_general == 'lung' and is_primary_data == True",
)
Routing Guidance
- Small/medium query (fits in RAM) →
get_anndata(). Seereferences/querying_expression.md. - Query exceeds RAM →
axis_query()with chunked iteration and incremental stats. Seereferences/querying_expression.md. - Training ML models →
tiledbsoma_mlPyTorch dataloader /ExperimentDataset. Seereferences/ml_and_scanpy.md. - Standard scanpy analysis / multi-tissue integration → see
references/ml_and_scanpy.md. - Need full schema, all metadata fields, or filter-syntax details →
references/census_schema.md.
Reference Index
references/querying_expression.md— Opening the Census, exploring metadata, small/mediumget_anndata()queries, and large out-of-coreaxis_query()processing with incremental statistics.references/ml_and_scanpy.md—tiledbsoma_mlPyTorch dataloader /ExperimentDatasettrain-test splits, scanpy integration, multi-dataset/tissue integration (anndata.concat), and four worked use cases.references/best_practices_and_troubleshooting.md— Primary-data filtering, version pinning, query-size estimation,tissue_generalvstissue, presence matrices, the full obs/var metadata field list, and a troubleshooting guide.references/census_schema.md— Census data structure, all metadata fields, value-filter syntax/operators, SOMA object types, and data inclusion criteria.references/common_patterns.md— Extras beyond the core recipes: incremental (Welford) variance out-of-core, ontology-term filtering, batch-processing sweeps, and a common-pitfalls list.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: AlterLab-IEU
- Source: AlterLab-IEU/AlterLab-Academic-Skills
- License: MIT
- Homepage: https://alterlab-ieu.github.io/AlterLab-Academic-Skills/
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.