Tables and comparisons

Turn populations into numbers for every sample, and compare groups of samples with a test chosen from the design rather than by habit.

Tables

The Tables view: a table of every population's percentage of parent for 12 samples, with condition, subject and batch columns, shown as a heat map with the mean and SD belowThe Tables view: a table of every population's percentage of parent for 12 samples, with condition, subject and batch columns, shown as a heat map with the mean and SD below
One row per sample, one column per statistic, with the samples' annotations alongside.

A table has one row per sample and one column per statistic. Create a table of every population builds the usual frequency table in one click: every population as a percentage of its parent. To build your own:

  1. Click New table, or start from the frequency table.
  2. Under Add a column, choose a Population and a Statistic, plus a Channel, Relative to population, or percentile or threshold where the statistic needs one. Click Add column, or All medians for the median of every fluorescence channel of the population.
  3. Under Rows, choose the samples (all, or a group), and whether to include controls.
KindStatistics
Counts and frequenciesCount; % of parent, grandparent, total or any ancestor; concentration per µL (from $VOL); absolute count per µL from counting beads (below)
LocationMedian, mean, geometric mean, mode
SpreadSD, robust SD, CV, robust CV, median absolute deviation (MAD)
DistributionMinimum, maximum, any percentile, % above a threshold
Rare eventsLower and upper 95% limits of the count (exact Poisson) and of the % of parent (exact binomial); counting CV
Against a control sample% positive by SED and by Overton subtraction; probability binning's T(χ) and % positive; the Kolmogorov–Smirnov D (below)

The robust SD is BD FACSDiva's: half the range around the median that holds 68.26% of the events, (P84.13 − P15.87) / 2, and the robust CV is 100 × that over the median. FlowJo 11's Robust SD is 1.4826 × the median absolute deviation instead; for a symmetric population the two agree, for a skewed or two-peaked one they do not. To reproduce FlowJo's, multiply the median absolute deviation by 1.4826. Medians match FlowJo's exactly.

Show a table as a Heat map, Copy it as TSV to paste into a spreadsheet, or save it as CSV. A column's menu renames, moves or removes it, sends it to Compare between groups, or adds detection limits. Frequencies in the inspector carry an exact 95% binomial confidence interval.

Excel and Prism

Both load the samples a table needs first. To put statistics on slides beside plots, add a Statistics item to a figure.

Absolute counts

Cells per µL of the sample, from counting beads (BD TruCount, CountBright and the like) added to each tube. Gate the beads (they are small on forward scatter and bright in every fluorescence channel), then add a column with the statistic Absolute count (/µL, counting beads), which asks for:

Cells per µL = cell events ÷ bead events × beads in the tube ÷ µL of sample × dilution (Brando et al. 2000). Its precision is set by both counts: the CV is about √(1/cell events + 1/bead events), so 1,000 beads already limit it to 3%. Instruments that record the volume they acquired ($VOL) give Concentration (/µL) without beads, which takes the same dilution factor.

The absolute-count example is whole blood from three patients in tubes of 50,000 counting beads, 50 µL of blood each; its suggested gates include the beads and the CD4 T cells, and every patient's true count is known.

Comparing with a control sample

A histogram of CD25 on T cells in a stimulated sample with the unstimulated sample of the same donor overlaid; below it, the stimulated sample against the unstimulated one: 31.0% positive by SED, 27.4% by Overton subtraction, probability binning T(χ) 577A histogram of CD25 on T cells in a stimulated sample with the unstimulated sample of the same donor overlaid; below it, the stimulated sample against the unstimulated one: 31.0% positive by SED, 27.4% by Overton subtraction, probability binning T(χ) 577
CD25 on T cells, stimulated, with the same donor's unstimulated sample overlaid: the comparison appears under the histogram.

How much of a stained sample lies above its FMO, or of a stimulated sample above its unstimulated control, when the two overlap too much for a gate? Choose one of the statistics against a control sample: the column then asks for the Control sample and, if it is not the same population, the Control population. Each sample's population is compared with the control's on the column's channel.

StatisticWhat it measures
% positive (SED)The share of the sample's events that are positive, by Bagwell's enhanced normalized subtraction, which FlowJo calls SED. It estimates the part of the positive population that overlaps the negative one, so it stays close to the true share when the two overlap.
% positive (Overton)Overton's cumulative subtraction: the largest gap between the control's and the sample's cumulative distributions, which is the Kolmogorov–Smirnov D in one direction. Exact for well-separated populations, it underestimates where they overlap.
T(χ) (probability binning)Roederer's metric: the control's events split into bins of equal counts and the sample's counted in them. Above 4, the distributions differ (p < 0.01); about 0 for two samples of the same cells.
% positive (probability binning)The share of the sample's events in excess of the control's in those bins.
K-S DThe largest difference between the two cumulative distributions, in either direction. With tens of thousands of events any difference is significant, so its p-value says little; D itself is a fair size of the difference.

All five come from the events' order, so they do not change with the axis scale. They assume the sample holds the control's population plus, perhaps, a positive one: a whole population shifted brighter (a voltage change, a different autofluorescence) reads as positive cells. Put such columns in Compare like any other, or choose the statistic there directly with its control.

On a histogram, overlay the control (More → Overlay other samples): the plot's sample is compared with each overlaid one and the result shown under the plot.

On simulated tubes with known shares, SED came within 2 points of the truth from 5% to 40% positive, while Overton fell 2–8 points short where the populations overlapped; CytoWeave's probability binning gives the same bins and statistic as the R package flowStats. See Validation.

Rare events

A rare population's frequency is only as precise as the number of its events: 100 events give a 10% CV, 25 events a 20% CV (Poisson counting). For a population of fewer than 10,000 events the inspector shows its counting CV, the exact 95% interval of the count and, below a 10% CV, how many events of the parent a 10% CV would take. In Tables, the lower and upper 95% limits of the count and of the % of parent are statistics of their own.

Detection limits

Whether a small value is real depends on what samples without the population show. A count or frequency column's menu → Add detection limits asks for:

The dialog computes, as CLSI EP17 and Armbruster & Pry (2008) describe:

Values at or below the limit of blank are marked ND (not detected), and values above it but below their sample's limit of quantification < LLOQ; a CSV adds a status column. EP17 asks for 20 blank and 20 low-level results to verify limits and 60 to establish them; the dialog says when there are fewer. The limits go into the methods text.

Comparing groups

The Compare view: the median CD25 of T cells, stimulated against unstimulated, paired by subject: a dot plot with lines joining each donor's samples, a paired t-test p = 3.1×10⁻⁵, the Wilcoxon signed-rank check, group summaries and effect sizes with 95% confidence intervalsThe Compare view: the median CD25 of T cells, stimulated against unstimulated, paired by subject: a dot plot with lines joining each donor's samples, a paired t-test p = 3.1×10⁻⁵, the Wilcoxon signed-rank check, group summaries and effect sizes with 95% confidence intervals
Median CD25 on T cells: six donors, paired by subject, so the paired t-test was chosen.
  1. What to compare: a Population statistic (for example the median CD25 of T cells, or the % of parent of Tregs), a Table column, or a Cluster's abundance.
  2. Design: Group samples by any annotation or by the workspace's groups, tick the groups, and choose the Reference (A). Pair samples by a subject field when the same donor is in each group.
  3. Test: leave Automatic (from the design), or choose one.

The automatic test follows the design, and its nonparametric counterpart is always shown beside it as a robustness check:

DesignTestCounterpart
Two groupsWelch's t-testMann–Whitney U
Two groups, pairedPaired t-testWilcoxon signed-rank
Several groupsWelch's ANOVAKruskal–Wallis
Several groups, repeated measuresRepeated-measures ANOVAFriedman

Several groups are followed by Holm-adjusted comparisons of each group with the reference. The result shows each group's n, mean, SD, median and IQR; effect sizes with 95% confidence intervals (the difference and ratio of means, or their paired forms, Hedges' g and the Hodges–Lehmann shift); and a note on the assumptions. Decide on the test before looking at the results: the second test is there to show the conclusion does not hang on the choice.

The plot shows every sample as a dot, with the mean and its 95% t confidence interval or the median and a 95% bootstrap interval, and lines joining paired samples; click a dot to see that sample's gating. Export it as SVG or PNG, copy the Methods text, or Save for report so the methods paragraph cites the comparison.

Robustness to analysis choices

Robustness to analysis choices for monocytes, stimulated against unstimulated: the conclusion mostly holds, with no significant difference in 51 of 64 analyses; a specification curve of the 64 differences with their confidence intervals, the ones drawn with a wider monocyte gate below zero in red, and the choices each analysis changed marked underneathRobustness to analysis choices for monocytes, stimulated against unstimulated: the conclusion mostly holds, with no significant difference in 51 of 64 analyses; a specification curve of the 64 differences with their confidence intervals, the ones drawn with a wider monocyte gate below zero in red, and the choices each analysis changed marked underneath
Monocytes do not change with stimulation, unless the monocyte gate is drawn wider: activated T cells, larger after stimulation, then fall into it.

A comparison rests on choices made before any test: where each gate was drawn, whether gates were adjusted per sample, whether acquisition QC was applied, which compensation matrix was used. Robustness to analysis choices, below the result, asks whether the conclusion would change had the data been processed differently in ways another analyst might reasonably have chosen. Click Check, and the comparison is repeated:

Each alternative is tried alone, then in random combinations, 64 analyses in all. The result says whether the conclusion holds (the same in at least 90% of them), mostly holds (70%) or is fragile, names the single choices that change it, and, for a difference that was found, the ones that move its size outside its confidence interval. The specification curve shows every analysis's difference with its 95% confidence interval, sorted, with the declared one in purple and those that reach a different conclusion in red; the marks underneath show which choices each changed. A table lists every single change.

The declared analysis stays the result: this measures how much it depends on choices that could have been made otherwise, and is not a way to look for the analysis that gives the wanted answer (a specification-curve analysis, Simonsohn et al. 2020). Methods text and Save for report include a sentence on the check. Scales are not varied: a gate drawn by hand follows its population on any scale, and the boundary moves cover where it was drawn.

The validation suite checks it against comparisons whose answer is known, on the PBMC example:

On an intracellular cytokine study (four donors), every PMA comparison holds in all analyses. One small peptide response (IL-4, 0.27 points) is fragile: it depends on the expert's per-donor gate adjustments and on 2% of a scatter gate.

Screening every population or cluster

Screen populations tests one statistic for every population at once, Screen clusters tests the abundance of every cluster of a clustering channel, and Screen marker states tests the expression of every marker in every cluster or population. Results are corrected for multiple testing (Benjamini–Hochberg, Benjamini–Yekutieli, Holm or Bonferroni) and shown on a volcano plot of effect against significance; click a point to compare that one in detail.

Cluster abundance (cells of the cluster ÷ cells of the parent population, per sample) is tested with a quasi-binomial GLM and a likelihood-ratio F test, in the manner of diffcyt, with optional covariates as fixed effects. Try it on the mass cytometry cohort example, where non-classical monocytes are doubled in the case group.

Differential state

A cell type can stay as frequent while its cells change: stimulated T cells raise CD25 and HLA-DR. Screen marker states asks, for each cluster (or population) and each marker, whether the marker's level differs between the groups, with diffcyt-DS-limma (Weber et al. 2019):

By default the markers the clustering was made from are left out (in diffcyt's terms, the "type" markers): their medians differ between clusters by construction, so only the others ("state" markers) are tested. The table gives each group's mean of the samples' medians, their difference (the effect, on the arcsinh scale), t, p and q.

Screen marker states: FlowSOM clusters of live cells from lineage markers, five activation markers tested between stimulated and unstimulated samples paired by donor; CD25 and HLA-DR up and CD127 down in the T-cell clustersScreen marker states: FlowSOM clusters of live cells from lineage markers, five activation markers tested between stimulated and unstimulated samples paired by donor; CD25 and HLA-DR up and CD127 down in the T-cell clusters
Differential state in the PBMC example: clusters made from lineage markers, the activation markers tested, stimulated against unstimulated with donors paired. CD25 and HLA-DR rise and CD127 falls in the T-cell clusters.

CytoWeave computes diffcyt's statistics itself, and the validation suite checks them against diffcyt 1.32 and limma 3.68 in R: on the mass cytometry examples every count and median is identical and every moderated t, p and adjusted p agrees within 3e-11. On ten donors' wells of the barcoded plate it finds the activation markers that change and calls few others; on the cohort, where no marker differs, it calls none. Agents and scripts run the same test with differential_analysis.

Where to go next