# Bootstrapping cell type identifications (scRNA-seq)

I have scRNA-seq data held in a SEURAT object, and cell-types were identified with SingleR (essentially a vector of strings - Monocytes, Granulocytes etc.). I have two conditions - treated and untreated. I want to know if the difference in the relative frequency (%) of a given cell type between the conditions is significant. For this, I thought to perform bootstrapping, to obtain frequencies for many different 'simulated' datasets - and then perform a statistical test. However, I cannot understand how best to do this. Should I subsample the scRNA-seq data, with replacement and calculate the frequencies each time? Can somebody provide a step by step workflow on how to do this?

I would use permutation:

i) Get the difference that you are interested in, i.e. number/proportion of monocytes in one group vs the other.

ii) Get the relevant columns (condition, cell label, ...) from the @meta.data slot of your seurat objects and rbind().

iii) Shuffle the cell labels randomly and split the data frame into two (per condition).

iv) Compare the difference between the cell counts/proportions of interest from the two permuted data frames and save this value.

iv) Repeat iii and iv for 100s of times and calculate how many times have you observed a difference at least as extreme as your real observation (i). Once divided by the number of trials, this would give you a p-value stating how likely it is that you get the observed value.

I have to add that batch effects are severe in scRNA-seq and hence a linear model where you might be able to account for batches could be more helpful.