Tutorials for using single-cell data with PyTorch. These materials are aimed at two groups: machine learning practitioners new to genomics, and genomics researchers wanting to use deep learning.
View the interactive tutorial website →
| Tutorial | Audience | Duration | Open in Colab | What it covers |
|---|---|---|---|---|
| Basics: Single-cell Data in AnnData format | ML practitioners new to single-cell data | 30-45 min | What scRNA-seq data is and how it differs from typical ML datasets | |
| Basics: Machine Learning with PyTorch | Genomics researchers new to ML | 45-60 min | PyTorch basics explained using genomics examples | |
| Single-cell data in PyTorch | All participants | 45-60 min | Use AnnData's AnnLoader for per-cell classification and regression |
|
| Grouped cell populations | Participants interested in sample-level prediction | 30-45 min | Model patient-region samples with PyTorch datasets and ggml-ot |
Suggested workshop flow: Choose the primer for the domain that is less familiar to you. In a mixed workshop, participants can work through the two primers in parallel, then regroup for Single-cell data in PyTorch. Continue with Grouped cell populations as an optional advanced tutorial.
Google Colab requires no local setup. To run the tutorials locally on macOS or Linux:
git clone https://github.com/DaminK/AnnData_PyTorch_Tutorials.git
cd AnnData_PyTorch_Tutorials
python -m venv .venv && .venv/bin/python -m pip install -r requirements.txt
.venv/bin/python -m jupyter labThe third line creates the virtual environment and installs the dependencies
into it in one shell command. Activation is not required. On Windows, replace
.venv/bin/python with .venv\Scripts\python.exe.
These tutorials show you how to:
- Load scRNA-seq data with Scanpy and inspect AnnData objects
- Build supervised models with PyTorch
- Handle sparse, high-dimensional biological data
- Batch cells with AnnData's
AnnLoaderand model grouped cell populations withggml-ot - Evaluate classification and regression workflows
The tutorials include notes explaining genomics concepts for ML practitioners and ML concepts for genomics researchers.
These tutorials use Scanpy, AnnData, PyTorch, and ggml-ot. Documentation is built with Jupyter Book.
Useful links:
- Single-cell best practices
- Scanpy tutorials
- PyTorch tutorials
- AnnLoader documentation - PyTorch batches from AnnData
- ggml-ot - Grouped-cell distribution learning
This project is available under the MIT License.