# Cellxgene Census

Query the CELLxGENE Census (61M+ cells) programmatically.

- Repository: https://github.com/LeonChaoX/qinyan-academic-skills (996 stars)
- Category: Engineering
- License: Unknown
- Last updated: 2026-07-20
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add LeonChaoX/qinyan-academic-skills --skill cellxgene-census -g -a claude-code -y`
Codex: `npx skills add LeonChaoX/qinyan-academic-skills --skill cellxgene-census -g -a codex -y`
Cursor: `npx skills add LeonChaoX/qinyan-academic-skills --skill cellxgene-census -g -a cursor -y`
Gemini CLI: `npx skills add LeonChaoX/qinyan-academic-skills --skill cellxgene-census -g -a gemini-cli -y`

## Description

Query the CELLxGENE Census (61M+ cells) programmatically. Use when you need expression data across tissues, diseases, or cell types from the largest curated single-cell atlas. Best for population-scale queries, reference atlas comparisons. For analyzing your own data use scanpy or scvi-tools.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# CZ CELLxGENE Census

## Overview

The CZ CELLxGENE Census provides programmatic access to a comprehensive, versioned collection of standardized single-cell genomics data from CZ CELLxGENE Discover. This skill enables efficient querying and analysis of millions of cells across thousands of datasets.

The Census includes:
- **61+ million cells** from human and mouse
- **Standardized metadata** (cell types, tissues, diseases, donors)
- **Raw gene expression** matrices
- **Pre-calculated embeddings** and statistics
- **Integration with PyTorch, scanpy, and other analysis tools**

## When to Use This Skill

This skill should be used 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

## Installation and Setup

Install the Census API:
```bash
uv pip install cellxgene-census
```

For machine learning workflows, install additional dependencies:
```bash
uv pip install cellxgene-census[experimental]
```

## Core Workflow Patterns

### 1. Opening the Census

Always use the context manager to ensure proper resource cleanup:

```python
import cellxgene_census

# Open latest stable version
with cellxgene_census.open_soma() as census:
    # Work with census data

# Open specific version for reproducibility
with cellxgene_census.open_soma(census_version="2023-07-25") as census:
    # Work with census data
```

**Key points:**
- Use context manager (`with` statement) for automatic cleanup
- Specify `census_version` for reproducible analyses
- Default opens latest "stable" release

### 2. Exploring Census Information

Before querying expression data, explore available datasets and metadata.

The rest: https://github.com/LeonChaoX/qinyan-academic-skills/blob/HEAD/skills/05-生物信息与基因组学/cellxgene-census/SKILL.md
