Differential abundance

Does a cell type make up more of the tissue in one group than another? SituCraft answers with each sample (or subject) as one observation, never each cell, by a model of the design, and gives the effect with its interval, not only a p-value.

The sample is the unit

A section holds thousands of cells, but its cells are not independent replicates: they share the subject, the slide and the run. Treated as replicates, they make tiny differences look certain. SituCraft compares the design's rows instead. Each row is a replicate unit, such as a subject, in a group, with its samples' cells combined (technical replicates). A paired design, such as each subject before and after, compares each subject with itself. See The design.

The models

Compare the groups in the Cohort view's Differential abundance fits a model for each label of the cohort table (see Sample summaries):

The models are fitted as R's glm fits them. Samples vary more than the binomial or Poisson model alone allows, so the variation is measured, not assumed: the dispersion is Pearson's χ² over the residual degrees of freedom. Each contrast of the design (each group against the reference, or those chosen) is tested by a t test on those degrees of freedom. A label no sample has a cell of, or one a group has none of, is left untested, and the reason is said.

Reading the results

For each label and contrast the table gives the effect with its interval (95% by default), the p-value, and the p-value adjusted by Benjamini and Hochberg over the family's tests (all its labels and contrasts). The universe of tests is stated with the family, so the correction can be read. Rows whose adjusted p is below 0.05 are marked higher or lower.

Choosing a row plots each replicate unit's share or density by group, with each group's mean. A point opens its sample's cells of that label on its tissue in the Viewer, so a result can be traced to the cells behind it. The results (CSV) writes every test.

The Cohort view's differential abundance of the simulated cohort: the four labels' odds ratios treated against control with their intervals and p-values, the endothelial-like row chosen, and its eight subjects' shares plotted by conditionThe Cohort view's differential abundance of the simulated cohort: the four labels' odds ratios treated against control with their intervals and p-values, the endothelial-like row chosen, and its eight subjects' shares plotted by condition
The simulated cohort's subjects compared by condition: the endothelial-like cells' odds 1.75 times as high in the treated subjects, the interval wide with four subjects a group.

An interval that is wide, as with four subjects in a group, says how little the samples pin the effect down. A larger cohort, or pairing, narrows it. In the cohort before and after, where after treatment a cell is four times as likely to be endothelial-like, six subjects compared with themselves find the endothelial-like cells' odds 2.19 times as high after (1.54 to 3.12) and the epithelial-like cells' 0.48 times (0.27 to 0.84), near the 2.26 and 0.47 the true cells show: more endothelial-like and immune-like cells leave less room for epithelial-like ones.

Regions of one section compared as pseudo-samples (see The design) are marked so on every result: their tests describe the section's places, not subjects.

Labels from a reference

The same steps on every sample (see Sample summaries) can label every sample from one labeled single-cell reference instead of a marker set: choose A reference on this computer… under Labels from. Every sample's labels then come from the same reference, with the same names. The start page's A simulated cohort includes a reference of its types, made with its panel.

By remote control

compare_abundance compares the samples (shares, densities and niches, by the design draft or a saved design) and answers every test. show_sample_cells shows a sample's cells of a label on its tissue. cohort_steps and summarize_samples take a reference to label from. See Remote control.

How it is checked