Sign in
BioinformaticsGenome biology
Peer-reviewed journal article

Scanpy for analysis of large-scale single-cell gene expression data

F. Alexander WolfiD, Philipp AngereriD, Fabian Joachim TheisiD

Abstract

We present Scanpy, a scalable toolkit for analyzing single-cell gene expression data. It includes preprocessing, visualization, clustering, pseudotime and trajectory inference, differential expression testing and simulation of gene regulatory networks. The Python-based implementation efficiently deals with datasets of more than one million cells and enables easy interfacing of advanced machine learning packages. Code is available from https://github.com/theislab/scanpy.

PDFDOICode
Full-text digest ↓

02 /Specification & Classification

Click any tag to browse matching papers

In-depth summary

✦ Multi-agent verified full-text synthesis

Claude Opus 5.5 · max effort · 8 Nov 2026 · from the full text (9 Aug 2017) · CC0 1.0

Python toolkit Scanpy, built on HDF5-backed AnnData, achieves speedups of 5 to 16 times over Cell Ranger's R kit and clusters 1.3 million cells without subsampling.

Integrated single-cell workflows in frameworks such as Seurat, Monocle, MAST, and Cell Ranger do not scale to data sets of one million cells or more, and these R-based tools are harder to couple with Python machine-learning libraries. Scanpy supplies comparable preprocessing, visualization, clustering, trajectory, and differential expression analyses in Python around a sparse, disk-backable data class, extending them to million-cell data.

Key results

  1. ShownMillion-cell data can be analyzed in full on modest hardware: 1.3 million cells were visualized and clustered without any subsampling.

    1.3 million E18 mouse brain cells from 10x Genomics were processed in a few hours on eight cores of a small server (Fig. 1c); exact run time and peak memory are not reported. · SCANPY is benchmarked in comparisons with…; Figure legends

  2. ShownOn 68,579 peripheral blood mononuclear cells (PBMCs), Scanpy ran representative analysis steps markedly faster than the run-time-optimized Cell Ranger R kit.

    Speedups of 5 to 16 times over the Cell Ranger R kit across the representative steps compared in Fig. 1b; only this range is given in the text, with no per-step timings or hardware description. · SCANPY is benchmarked in comparisons with…; Figure legends

  3. ShownReproducing a Seurat clustering tutorial end to end, from raw counts to cell-type identification, Scanpy was faster than Seurat at every step.

    Per-step speedups ranged between 5 and 90 times on 2700 PBMCs; the step-by-step comparison lives in the scanpy_usage repository (170505_seurat) rather than in a table in the text. · SCANPY is benchmarked in comparisons with…; Availability and requirements

  4. ShownApplied to the 68,579 PBMCs, the workflow (confounder regression, normalization, highly variable genes, Louvain clustering, marker ranking, pseudotime) produced a cluster marker matching bulk-derived labels and a branching trajectory.

    Differential expression ranking singled out MS4A1 as the B-cell marker of cluster 7, consistent with labels from comparisons with bulk expression; diffusion pseudotime rooted at a cell in the CD34+ cluster revealed a branch, displayed on tSNE and diffusion maps (Fig. 1a). · Figure legends; SCANPY integrates canonical analysis methods in…

  5. ClaimedScanpy's efficiency is attributed to design choices: a sparse, HDF5-backable AnnData container usable without full loading into memory, in-place operations, parallelized tools, and a single reusable neighborhood graph computed faster than in a popular reference package.

    Neighbor distances are computed per row-aggregated submatrix using parallelized matrix multiplication; the text gives no timings, memory figures, or name of the reference package for the graph and backed-mode claims. · SCANPY introduces efficient modular…; Comparison with existing Python packages for…

Methods, data and reproducibility

Scanpy implements preprocessing, tSNE, graph-drawing and diffusion-map visualization, graph-based Louvain clustering, differential expression ranking, diffusion pseudotime, and gene regulatory network simulation around AnnData, an HDF5-backable annotated matrix class; run time is benchmarked against Seurat and the Cell Ranger R kit on 10x Genomics data.

  • Peripheral blood mononuclear cells analyzed for the Cell Ranger R kit speed comparison and the Fig. 1a workflow demonstration · n = 68,579 cells
  • PBMCs from a Seurat clustering tutorial, reanalyzed from raw counts to cell types for the Seurat speed benchmark · n = 2700 cells
  • E18 mouse brain cells from 10x Genomics, visualized and clustered without subsampling · mouse · n = 1.3 million cells
  • Data from the original diffusion pseudotime study, reanalyzed to reconstruct branching developmental processes (scanpy_usage 170502_haghverdi16)
  • Single cells simulated from literature-curated gene regulatory networks (scanpy_usage 170430_krumsiek11)
  • Deep-learning results on single-cell imaging data (scanpy_usage 170529_images)
Methods & tools
Scanpy (Python toolkit for single-cell expression analysis), AnnData (annotated data matrix class with sparse and HDF5-backed storage), Seurat (speed comparator via its 2700-PBMC clustering tutorial), Cell Ranger R kit (speed comparator on 68,579 PBMCs), Louvain clustering, Diffusion maps and diffusion pseudotime, tSNE and Fruchterman-Reingold graph drawing, Principal component analysis, NumPy, SciPy, pandas, Matplotlib, h5py (core dependencies), scikit-learn, statsmodels, seaborn, NetworkX, igraph (used by parts of the toolkit), loompy / loom format (AnnData import and export)
Software & environment
Python package on PyPI (BSD3 license) for Linux, Mac OS, and Windows; core depends on NumPy, SciPy, Matplotlib, pandas, h5py, with scikit-learn, statsmodels, seaborn, NetworkX, igraph, tSNE and Louvain packages for some tools; no versions given.
Assay conditions & compute
The 1.3 million-cell analysis took a few hours on eight cores of a small server; interactive run times of seconds are stated for about 100,000 cells; CPU model, memory, and benchmark hardware are not given.
Reproducibility gaps
No software versions, hardware specifications, per-step timings, or memory measurements appear in the text; benchmark details are deferred to external scanpy_usage notebooks, and the three 10x Genomics data sets are cited without URLs or accessions.
Limitations (3)
  • The Python ecosystem underlying Scanpy offers fewer options for classical statistical analyses than R. · stated by the authors
  • Speed benchmarks give only ranges (5 to 16 and 5 to 90 times) without per-step timings, hardware, or memory use, and the text reports no concordance of clusters or markers with Seurat or Cell Ranger outputs. · noted in this summary
  • The 1.3 million-cell demonstration covers only visualization and clustering, and the faster neighborhood-graph computation and HDF5 backed mode are asserted without quantitative benchmarks or a named reference package. · noted in this summary

Who should read:Read this if you analyze large single-cell expression data sets, up to a million cells or more, in Python, or want the design rationale behind AnnData and Scanpy's shared neighborhood graph.

Reproducibility ledger

Nobody has reported trying to reproduce this paper yet. Did you replicate an experiment or run the code? Your report saves the next lab a week.

Sign in to file a reproducibility report.

Similarity Map
SelectedSame fieldCross-field
THISGardeux '17Zhang '20Moreno '21Xuan '26Abdelaal '20Zhang '22
65% semantic matchBioinformatics
Vincent Gardeux, Fabrice P.A. David, Adrian Shajkofci+2 more·Bioinformatics·May 23, 2017· 134 citations