Jupyter Notebook Examples
These example notebooks demonstrate how to use Celldega to analyze and visualize spatial and single-cell data. Each notebook is designed to be run in a Jupyter environment and showcases different features of the library.
Spatial Transcriptomics Tutorials
Comprehensive tutorials that walk through complete workflows:
- Atera Kidney Landscape-Clustergram - Direct Scanpy and AnnData steps for default clusters, linked dotplot Clustergrams, and cell-type composition across podocyte-defined glomerular gradients
- Atera Brain Hippocampus H&E Landscape-Matrix - Non-diseased fresh-frozen hippocampus with an aligned post-run H&E image: switch the Landscape and Yearbook between fluorescence and H&E, and link the default clusters to a pre-clustered Matrix, Clustergram and Enrich
- Atera Breast Cancer FF H&E Landscape-Matrix - Fresh-frozen breast cancer with an aligned post-run H&E image, a cell Yearbook, and default clusters linked to a pre-clustered Matrix, Clustergram and Enrich
- Atera Colorectal Cancer H&E Landscape-Matrix - Fresh-frozen colorectal cancer with an aligned post-run H&E image, a cell Yearbook, and default clusters linked to a pre-clustered Matrix, Clustergram and Enrich
- Atera Breast Cancer Landscape-Clustergram - Loads a precomputed Scanpy clustering (or optionally recomputes it) and creates linked Landscape, Clustergram, and Enrich widgets
- Atera Breast Cancer Neighborhood Exploration - Continues the Atera tutorial with hextile niches linked to cell-type composition and alpha-shape overlap linked to a separate Landscape
- Visium HD Human CRC Landscape-Clustergram-Enrich - Uses Scanpy and plain AnnData to summarize a clustered Visium HD colorectal cancer sample (signatures, fraction expressing, marker genes) and explores it in linked Landscape, Clustergram, and Enrich widgets, ready for interactive annotation
- Scanpy-Squidpy Xenium Pancreas - Full analysis workflow using Scanpy and Squidpy with Xenium data
3D Spatial Transcriptomics
Explore the Broad–Allen E15.5 developing mouse brain across 43 aligned Xenium sections. Follow these notebooks in order, or open the visualization notebook directly to use the already hosted DegaFiles:
- Broad–Allen Mouse Brain: Preprocessing and Alignment — align sections using cluster-centroid landmarks and neighborhood overlap, compare the results, and write named CellCloud DegaFiles variants.
- Broad–Allen Mouse Brain: Visualization — explore a 2D section, compare cluster composition across slices, and link the 3D CellCloud to a gene-expression Clustergram.
Single Cell Tutorials
Tutorials that explore single-cell RNA-seq data with UMAP Landscapes linked to Clustergrams:
- Chromium PBMC Landscape-Clustergram-Enrich - Clusters the 10x Chromium PBMC 3k dataset with Scanpy and explores it from Hugging Face: a UMAP Landscape that reads the AnnData Zarr store in the browser, a Clustergram of each cluster's
rank_genes_groupsmarkers loaded from a Matrix Zarr store, and a single-cell Clustergram of the same markers linked to its own Landscape, each with Enrich - Tabula Sapiens Atlas Landscape-Clustergram-Enrich - Explores the 1.1-million-cell Tabula Sapiens atlas from AnnData Zarr stores on Hugging Face: a UMAP Landscape with cell-type signature estimates as you zoom, a cell-type marker Clustergram and Enrich linked to it, and a plasma-cell subset with its own signatures
Brief Notebooks
Focused examples demonstrating specific features:
- Landscape View Xenium - Basic Landscape visualization of Xenium data
- Landscape from a Local Server - Viewing locally stored DegaFiles in a Landscape with
dega.viz.get_local_server() - Atera Pre-process - Making DegaFiles from a 10x Atera output bundle with
dega.pre.mainand viewing them in a Landscape - Atera Pre-process with H&E - Downloading a 10x Atera bundle with its post-run H&E image, making DegaFiles (one file per tile for GitHub, or row groups for Hugging Face), and adding the aligned H&E with
dega.pre.add_aligned_he - Atera Kidney Yearbook Review - Find large endothelial cells with podocyte (NPHS2) transcripts using
dega.select, review their portraits, and get the selected IDs - CellCloud Thick MERFISH - 3D orbit-camera CellCloud view of thick-tissue MERFISH data
- Landscape-Heatmap Visium-HD - Combined Landscape and heatmap visualization
- UMAP-Cluster Pancreas Xenium - UMAP clustering with Xenium pancreas data
- Custom Segmentation - Using custom cell segmentation with Celldega
- Gradient Neighborhood Pancreas Islets - Building inward/outward gradient rings around pancreatic islets and profiling cell-type proportion and hormone expression with distance from the islet edge
Running the Notebooks
Prerequisites
Install Celldega and its dependencies:
pip install celldega
For full analysis workflows, you may also need:
pip install scanpy squidpy
Online Resources
You can also run Celldega notebooks in the cloud:
Contributing examples
Instructions for publishing notebooks with saved widget state are in Contributing.