Answers.Body: <p>I would use permutation:</p>
  <p>i) Get the difference that you are interested in, i.e. number/proportion of monocytes in one group vs the other.</p>
  <p>ii) Get the relevant columns (condition, cell label, ...) from the <code>@meta.data</code> slot of your seurat objects and <code>rbind()</code>.</p>
  <p>iii) Shuffle the cell labels randomly and split the data frame into two (per condition).</p>
  <p>iv) Compare the difference between the cell counts/proportions of interest from the two permuted data frames and save this value.</p>
  <p>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.</p>
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-05T17:24:05.533Z
Answers.LastActivityDate: 2020-10-05T17:24:05.533Z
Answers.UserDisplayName: haci
Body: <p>I have scRNA-seq data held in a <code>SEURAT</code> object, and cell-types were identified with <code>SingleR</code> (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?</p>
  
Tags: <scrnaseq><r>
Title: Bootstrapping cell type identifications (scRNA-seq)
ThreadText: # Bootstrapping cell type identifications (scRNA-seq)
  
  (Asked by: username_0 on 2020-08-05)
  
  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?
  
  **Tags:** scrnaseq, r
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-10-05. Score: 0 | Accepted answer
  
  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.
  
  
  ---
  
  