Differential State analysis?
Hi!
I was wondering if there is option to use this for differential state analysis (differential expressiona analysis between stim vs ctrl) in a certain cell subset like B cells. So differential expression between stim B-cells and ctrl B cells? If so, how would you do this?
Thank you.
Hi Sarah,
Yes, you can use LEMUR for differential state analysis! If you are particularly interested in the gene expression changes occurring in B cells, you would run LEMUR only on the B cells and test which genes show significant gene expression changes for subgroups of B cells.
The code to do so would look something like this:
# I assume your full dataset is a SingleCellExperiment
sce <- ...
# I assume you keep the cell type labels in a column called `cell_type`
sce_bcells <- sce[,sce$cell_type == "B cell"]
library(lemur)
# I assume the stimulation/ctrl labels are kept in a column called `condition`
fit <- lemur(sce_bcells, design = ~ condition, n_embedding = 15)
fit <- align_harmony(fit)
fit <- test_de(fit, contrast = cond(condition = "stim") - cond(condition = "ctrl"))
# I assume you have multiple mice per treatment condition (`mouse_id`)
nei <- find_de_neighborhoods(fit, group_by = vars(mouse_id, condition))
The nei data.frame contains one row for each gene with an assessment if it changes between conditions and a vector of cell names for which the gene shows maximal expression change. In the example, I set n_embedding=15. This is just a default value; in your particular example I would recommend also trying smaller values (e.g., 5, 8) as I assume you will have less heterogeneity within the B cells than you typically see for a full set of PBMC.