scanpy
Standard single-cell RNA-seq analysis pipeline. Use for QC, normalization, dimensionality reduction (PCA/UMAP/t-SNE), clustering, differential expression, visualization, and converting R-friendly single-cell formats such as Seurat or SingleCellExperiment RDS files into h5ad for Scanpy. Best for exploratory scRNA-seq analysis with established workflows. For deep learning models use scvi-tools; for data format questions use anndata.
Author
Category
Development ToolsInstall
Hot:9
Download and extract to your skills directory
Copy command and send to AI Agent for auto-install:
Download and install this skill https://openskills.cc/api/download?slug=k-dense-ai-skills-scanpy&locale=en&source=copy
Scanpy - Python Standard Toolkit for Single-Cell RNA-seq Analysis
Skill Overview
Scanpy is an extensible single-cell transcriptomics analysis toolkit based on Python. It provides a complete analysis workflow from quality control to cell-type annotation, supports common data formats, and enables interoperability with R.
Use Cases
1. End-to-End Analysis Pipeline for Single-Cell RNA-seq Data
Suitable for single-cell transcriptomics data in formats such as 10X Genomics, CSV, and h5ad. It covers quality control, normalization, identification of highly variable genes, dimensionality reduction (PCA/UMAP/t-SNE), Leiden clustering, marker gene identification, and cell-type annotation. It offers one-click end-to-end analysis scripts and also supports step-by-step iterative analysis, meeting needs ranging from beginners to advanced researchers.
2. Conversion and Interoperability of Single-Cell Data Formats in R
Designed specifically to handle single-cell objects from the R ecosystem (e.g., Seurat, SingleCellExperiment). It converts them into Scanpy-native h5ad format while preserving raw counts, metadata, and gene identifiers. It supports cross-platform conversion workflows (macOS, Linux, Windows), allowing researchers to fully leverage Python’s data analysis ecosystem while maintaining compatibility with the R bioinformatics community.
3. Publication-Grade Single-Cell Visualizations and Figure Production
Generates single-cell figures that meet journal publication standards, including UMAP/t-SNE dimensionality reduction plots, quality-control violin plots, marker gene heatmaps and dot plots, trajectory analysis plots, and more. Supports high-resolution PDF export, custom color palettes, and multi-panel composite figures. Built-in plotting scripts automatically handle figure parameter settings, ensuring consistent and high-quality visuals for scientific papers.
Core Features
1. Complete CLI Script Toolkit
Provides 15+ ready-to-use command-line scripts covering every part of single-cell analysis:
run_pipeline.py for one-click execution of the full pipeline, qc_analysis.py for automated quality control, reduce_dimensions.py for dimensionality reduction, cluster.py for multi-resolution clustering, and find_markers.py for marker gene identification. All scripts use .h5ad as input/output, support pipeline-style chaining, and include detailed help documentation and parameter explanations, greatly reducing the effort required to write code.2. Quality Control and Data Preprocessing
Automatically identifies mitochondrial genes, computes quality control metrics, and generates visualization diagnostic plots. Supports cell filtering based on thresholds and distributions. The integrated Scrublet doublet detection can identify and remove doublets before normalization. Provides preprocessing functions such as
normalize_total normalization, log1p log transformation, highly variable gene identification, regression of unwanted variation, and data scaling. All operations preserve the raw counts layer (counts layer) and a backup of the raw data (adata.raw).3. Diverse Dimensionality Reduction, Clustering, and Visualization Analyses
Supports PCA and explained variance ratio analysis, neighborhood graph construction, UMAP and t-SNE nonlinear dimensionality reduction, and Leiden/Louvain clustering algorithms (supports multi-resolution parallel execution). Provides trajectory inference methods such as PAGA plots abstraction and diffusion pseudotime. Visualization includes a complete scanpy plotting API: UMAP coloring plots, quality metric violin plots, marker gene heatmaps and dot plots, visualization of
rank_genes_groups results, and more. All figures support publication-grade DPI and automatic saving.Frequently Asked Questions
What type of single-cell data analysis is Scanpy suitable for? What are the advantages over Seurat?
Scanpy is designed for exploratory analysis of single-cell RNA-seq (scRNA-seq) data, especially well suited to standardized analysis workflows based on established pipelines. Compared with Seurat (R), Scanpy’s main advantages are: seamless integration with the Python data science ecosystem (NumPy, Pandas, Scikit-learn), better handling of large-scale datasets, support for Dask for out-of-core memory computations, and a rich CLI script toolkit. If your team is more familiar with Python, needs to integrate with other Python toolchains, or works with extremely large datasets, Scanpy is the better choice. For deep learning models and probabilistic inference, it is recommended to use dedicated scvi-tools.
How do I get started with Scanpy? What are the requirements for Python version and system configuration?
Installation is straightforward: run
uv pip install "scanpy[leiden]" to obtain full functionality, including dependencies needed for Leiden clustering. Scanpy 1.12.x requires Python 3.12 or higher and anndata ≥ 0.10. For large datasets, you can optionally install Dask support for out-of-core computations. For system configuration, ordinary single-cell datasets (tens of thousands of cells) can run with 8GB of RAM; for very large datasets, 16GB+ is recommended. The toolkit provides complete analysis templates (assets/analysis_template.py) and step-by-step scripts. It is recommended to start with the one-click script run_pipeline.py, then customize progressively as needed.How can I convert existing Seurat or SingleCellExperiment R data into a Scanpy-compatible format?
Do not try to parse Seurat
.rds files directly in Python. The correct workflow is: in an R environment, use the Bioconductor packages zellkonverter or seurat-disk for conversion, preserving raw counts, cell metadata, and gene identifiers. The toolkit includes a detailed reference document references/r_interop.md, covering R installation on macOS, Linux, and Windows, installation of CRAN/Bioconductor packages, writing conversion scripts, and validation. After conversion, the resulting .h5ad files can be read by all Scanpy scripts directly, enabling seamless integration between R and Python analysis workflows.