Cohort QC, batches and panels

A difference between groups is only as good as the samples behind it. Before any comparison, SituCraft lays the samples side by side, flags those far from the others with the reason, shows how the batches fall across the groups, and compares the panels, so that only genes every sample measured are compared.

Quality by sample

The Cohort view's Cohort QC, batches and panels reads the cohort table's summary (see Sample summaries). It lists each sample's quality numbers beside its bundle's slide, run and panel:

These follow a sample's quality, not its size: the cells and transcripts in all, and the tissue's area, are left out. A segmentation that records no nucleus shows its nuclei's numbers as missing, never zero. The instrument's segmentation takes its nuclei from the bundle's cells table.

A sample is far out on a number when it meets both of these conditions:

Where half the samples agree exactly, the mean absolute deviation (times 1.2533) is the spread instead. Fewer than five samples are too few to call one far out.

A sample far out is highlighted, and listed with the reason in words, such as median transcripts 43.0, 0.386 times the samples' median of 112 (robust z −9.5). Nothing is passed or failed. Leave it out of the design… asks why, and the design keeps the reason with the sample (see The design). A sample is left out of a comparison only that way.

The Cohort view's QC of a simulated cohort with a planted outlier: each sample's quality numbers beside its slide, run and panel, the sixth sample's median transcripts, median genes and transcripts per 100 µm² highlighted, and its reasons listedThe Cohort view's QC of a simulated cohort with a planted outlier: each sample's quality numbers beside its slide, run and panel, the sixth sample's median transcripts, median genes and transcripts per 100 µm² highlighted, and its reasons listed
A simulated cohort whose sixth sample detects 40% of its transcripts: found far out on its transcripts and genes, with the reasons.

Batches

By batch gives the samples' median of each number by slide, by run and by panel. A batch whose samples differ from the others' is worth knowing before any comparison.

Batches and groups counts each slide's, run's and panel's samples in each of the design's groups. A batch that holds only one group confounds the groups with it: a difference between them could be the batch's. SituCraft says so here, and the design refuses to compare them unless it adjusts for that batch. Batches that hold the groups unevenly are noted. SituCraft corrects for no batch unless the design names it as a covariate.

The pseudobulk's principal components

Each sample's pseudobulk (its labeled cells' transcripts, summed) over the genes every panel has becomes log2(1 + counts per million). The 500 most variable genes are kept, as DESeq2's plot of principal components keeps its top genes. They are centered and decomposed into principal components, with nothing corrected.

The plot shows the samples on any two components, colored by any field: the groups, the subject, the slide, the run or the panel. Samples that gather by a batch rather than by group show a batch effect to account for, and a sample apart from all is one to look at. Each sample's scores are also in the cohort table (its family The pseudobulk's principal components), and SituCraft's components are checked against numpy's on every change.

Panels

Samples read with different gene panels can be compared only on the genes every panel has. SituCraft compares each sample's panel from its bundle, matching genes by name as transcripts carry them, and lists:

The Lung and Breast development bundles, for example, share 67 of their 289 and 280 genes.

By remote control

cohort_qc reads a summary's QC: each sample's numbers and batches, the samples far out with their reasons, the numbers by batch, the design's batches by group with what it says of confounding, the principal components and the panels. compare_panels compares the samples' panels before any summary. See Remote control.

How it is checked

The validation suite checks:

The principal components equal numpy's to 10⁻¹³ on three cases, and the rule for flagging a sample is checked by hand.