Calculating celltype proportion changes between conditions in single-cell data I want to test for significance between differences in cell count between conditions.

I have 2 conditions (N, T), 3 donors (samples) each, and four cell types (A-D) as shown in the example below.

I believe this problem is analogous to the differential expression test performed with edgeR or DEseq.

Example data:

Count   Sample  Celltype    Condition
555 P1  D   T
3829    P1  C   T
945 P1  A   T
222 P1  B   T
795 P2  D   T
5464    P2  C   T
839 P2  A   T
438 P2  B   T
629 P3  D   T
6426    P3  C   T
647 P3  A   T
457 P3  B   T
8   P1  D   N
5122    P1  C   N
3204    P1  A   N
1   P1  B   N
20  P2  D   N
6111    P2  C   N
2524    P2  A   N
26  P2  B   N
66  P3  D   N
7490    P3  C   N
5272    P3  A   N
3   P3  B   N
This publication used a negative binomial regression model of the counts of cells at each time-point.

From the methods section: "For each cell type, we model the number of lineage-labelled cells detected in each analysed mouse as a random count variable using a negative binomial distribution. The frequency of detection is modelled by using the natural log of the total number of cells of that type profiled in a given mouse as an offset. The time point of each mouse (0, 30 or 60 days post tamoxifen) is provided as a covariate. The negative binomial model was fit using the R command ‘glm.nb’ from the ‘MASS’ package. The P value for the significance of the change in labelled fraction size between time-points was assessed using a likelihood-ratio test, computing using the R function ‘anova’."

The method is available here as an R script.

The input x is a dataframe with the following columns:

x$variable # celltype
x$value # cell count
x$batch # condition+donor
x$timepoint # condition (e.g. adult, fetal)


Montoro, D.T., Haber, A.L., Biton, M. et al. A revised airway epithelial hierarchy includes CFTR-expressing ionocytes. Nature 560, 319–324 (2018) doi:10.1038/s41586-018-0393-7