Downloads
None of the code in this book runs in the browser: every example imports the
singlecell package and most read or write files, and package imports and file
I/O are CLI-only. So the pages show no Run button — copy the code, or take one
of these.
The starter kit
singlecell-starter.zip — the package, the data-download script, every chapter script and the notebook.
unzip singlecell-starter.zip && cd singlecell-starter
bl install ./singlecell
python get-data.py
bl run ch01.bl
Full setup, including installing BioLang itself, is in Getting the Data.
The data script
get-data.py — fetches the two 10x matrices from the
HBC course’s own host. 3.2 GB down, ~90 MB kept; the archive is deleted unless
you pass --keep. Also included in the kit.
Chapter scripts
One per chapter, each self-contained.
| Chapter | Script | Blocks |
|---|---|---|
| The Biology and the Matrix | ch01.bl | 1 |
| Quality Control | ch02.bl | 3 |
| Normalization and PCA | ch03.bl | 4 |
| Integration | ch04.bl | 2 |
| Clustering | ch05.bl | 4 |
| Markers and Annotation | ch06.bl | 4 |
| The Whole Workflow | ch07.bl | 4 |
These are not quick, and here is what they actually cost. Measured on a laptop, single-threaded:
Script Time ch012 s ch02~1 min ch03~2 min ch043 min 35 s ch053 min 50 s ch06over 9 min ch07over 9 min Two things drive this. Each block on a page is written to stand alone, so a reader can copy any one without having run the others — which means a concatenated chapter rebuilds the pipeline from the raw matrix once per block. And two operations are inherently expensive on 15,000 cells:
plot_markersruns a test per gene per cluster and takes 5 minutes by itself, andcluster_diagnosticscomputes a silhouette and takes 3.
ch06andch07were confirmed to run only in pieces, not as single scripts inside a ten-minute budget. Nothing in them is broken — every block produced the figure on its page — but if you want to follow along interactively, lift a single block rather than running a whole chapter.
The course-aligned pipeline
aligned.bl — the course’s settings rather than this book’s: their four-criterion QC filter, SCTransform, 40 PCs, resolution 0.8. It prints both cluster counts side by side so you can see what the parameters cost:
cells: 14847
GPU auto --no-gpu
SCTransform / 40 PCs / res 0.8 15 16
log1p / 30 PCs / res 0.5 8 8
Measured after the SNN-default change on 9 August 2026: 34.9 seconds with GPU
auto-detection enabled (NVIDIA RTX 3080), and 33.0 seconds with --no-gpu.
exact.bl — the full integrated configuration: both samples, their filter, SCTransform, Harmony, 40 PCs, resolution 0.8:
mode cells clusters wall time
GPU auto 29629 18 71.9 s
--no-gpu 29629 16 72.5 s
Historical HBC HTML 17
Both modes were measured on the same release build. Large-data neighbour ranking uses different numerical/search backends on GPU and CPU, so cells near a graph boundary can move and the Leiden count is not guaranteed to match. An independent current HBC CCA run with Seurat 5.5.1 gives 19 clusters; the cell-level comparison is recorded in What Differs from the Course. Harmony was the largest timed stage, not PCA or neighbour search; the measured breakdown is recorded in What Differs from the Course.
What Differs from the Course has the full account: what was rewritten to match Seurat’s published methods, why the count moved away from 17 as those fixes landed, and why one cluster count was a poor target to aim at in the first place.
The notebook
hbc-scrnaseq.bln — prose and code together, runnable end to end:
bl notebook hbc-scrnaseq.bln
Several chapters write .svg figures into the current directory. The notebook
carries the same content as the book, minus the figures, whose paths would not
resolve beside a downloaded file.
What you cannot download here
The dataset itself. It belongs to the study authors and is hosted by the HBC
training team; get-data.py fetches it from them rather than redistributing a
copy. See Attribution and Licence.