Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differential State analysis? #15

Open
castro019 opened this issue Apr 22, 2024 · 1 comment
Open

Differential State analysis? #15

castro019 opened this issue Apr 22, 2024 · 1 comment

Comments

@castro019
Copy link

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.

@const-ae
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants