Skip to content

Flow Cytometry

Flow cytometry measures protein on single cells as they pass a laser, and the analysis problem is not the measurement but the gate. A panel of ten colours produces 45 biaxial plots, and a 40-marker spectral panel produces 780. The person who draws the gates by hand is a large source of variation between laboratories, and the software that replaces them is almost all command-line R that clinical labs do not use.

This section takes public data through the full computational path, in R, in one pinned container. Every number on these pages comes from a real run of the code you can read on the page, and the run needs no network, because the container carries the data.

The first four pages are the concepts, and none of their code runs. The eight pages after them run in the container.

Page What it does
How flow cytometry works fluidics, optics and detectors, what scatter measures, where spillover comes from, and how conventional, spectral and mass cytometry differ
Compensation and panel design why spectral overlap needs correcting, and how to choose a panel that avoids the worst of it
Manual versus automated gating the reproducibility argument, and what the high-dimensional alternatives are
Analysis tools the R and Python packages, and where each one fits
FCS I/O what flowCore sees in an FCS file: one file and a set, the first scatter plot, parameters, keywords, the metadata you must keep
Compensation the spillover matrix applied on the linear scale, and what a second compensation does to ten thousand events the instrument most likely compensated already
Transformation and QC logicle and arcsinh side by side, and removing poor events with flowAI
Gating the sequential hierarchy, and what one fixed boundary costs across two samples
Automated gating an openCyto template, fitted per sample, including a gate that fails
Clustering FlowSOM and UMAP to find populations the gate did not name, then the same events through pytometry and through Seumetry in Seurat
Identifying cells from clusters scoring each cluster against a table of marker rules, and the margin that says which labels to trust
Harmonisation how much of a flow result is the analyst, and what a centralised analysis removes

Three further pages run on deposits too large to ship in a container. They carry a visible note saying so, and every number on them comes from a real run in the everything-flow-cytometry repository rather than from this site’s own.

Page What it does
Computing compensation from controls building the spillover matrix from single stains, and finding the stored one was typed by hand
Gating a published panel an openCyto template against OMIP-039, where the authors’ own gates are deposited too
Spectral flow cytometry what unmixing changes, the channel that silently disappears, and a 35 marker reanalysis

The package set for computational cytometry lives in R and Bioconductor: flowCore, flowAI, ggcyto, CATALYST, FlowSOM, and HDCytoData for the bundled teaching datasets. Python reads FCS files into AnnData, but most of the gating and clustering workflow is R. The runnable pages are R, and the clustering page also runs the FlowSOM steps in Python through pytometry and in Seurat through Seumetry.

The pages use two sources. The I/O, compensation and transformation pages use the small FCS files that ship inside flowCore. The gating, automated gating, clustering, cell identification and harmonization pages use the Bodenmiller BCR-XL mass cytometry dataset, provided through HDCytoData. The section image carries these teaching files. The three larger reports listed above use separate deposits and their own documented execution path.

The Bodenmiller example has eight donors with stimulated and unstimulated samples. After cell identification, retain a table with one population count and its denominator per sample, together with donor and condition. The section stops at population identification and harmonization; it does not fit a condition comparison. The mixed effects lesson explains how repeated measurements affect a model. Its continuous outcome example does not replace a model suited to cytometry counts or proportions.

The companion repository is private. Its cytometry setup instructions and FCS reader require repository access. From the repository root, build the image with bash guides/flow-cytometry/containers/cyto/build.sh, then run bash guides/flow-cytometry/fcs-io/run.sh. It reads the packaged FCS data and writes figures and printed results under guides/flow-cytometry/fcs-io/outputs/. The two public package links above provide the teaching data independently of this repository.