Looking for differential gene expression between treatment, within a specific cluster (seurat)
3
1
Entering edit mode
3.5 years ago
cook.675 ▴ 190

This one is driving me crazy. I have two data sets, a Vehicle and a Stimulated. These went through the work flow and were integrated as per the the following vignette: Satija lab:Integrating stimulated vs. control PBMC datasets

Everything works great, the data is great. I can find differentially expressed genes for each cluster, irrespective of treatment just fine.

But now I want to find the differentially expressed genes between treatments, within one cluster that I specify. And Im trying to do it in the following way, and I can't figure out why it doesn't work. Everytime the output is the same, no matter what value I enter for subset.ident. Heres an example. My data is in AllCells.combined

 Idents(AllCells.combined) <- AllCells.combined@meta.data$stim DefaultAssay(AllCells.combined) <- "RNA" immune.deg.cluster0 <- FindMarkers(AllCells.combined, ident.1 = "VEH", ident.2 = "IMQ", verbose = TRUE, subset.ident = "0" logfc.threshold = log(2))  This code works for cluster 0 (at least I think its cluster 0) But if i change subset.ident to 1, which I would want to think it would point to cluster 1, it gives me the exact same values as if I had subset 0 I tried using the group.by argument also to no avail. Any ideas? Thanks! seurat • 9.3k views ADD COMMENT 1 Entering edit mode 3.5 years ago You're setting your Idents to your stimulation conditions, so it how would it subset by cluster? Leave your Idents set to the clusters, then use group.by and subset.ident to set your groups to compare. I think something like the following is what you want: Idents(AllCells.combined) <- AllCells.combined$seurat_clusters
DefaultAssay(AllCells.combined) <- "RNA"
immune.deg.cluster0 <- FindMarkers(AllCells.combined, ident.1 = "VEH", ident.2 = "IMQ", verbose = TRUE, group.by="stim", subset.ident = "1", logfc.threshold = log(2))

0
Entering edit mode

Thanks Jared I didnt see this before I posted my follow up ill give it a try....

So I just tried it with cluster 1 and it gives me this error:

>   Error in WhichCells.Seurat(object = x, cells = cells, idents = idents,  : Cannot find the following identities in the object: 1

0
Entering edit mode
3.5 years ago
cook.675 ▴ 190

So I run head(Idents(AllCells.combined)) and get this:

Veh2_AAACCTGAGATCCTGT Veh2_AAACCTGCAGTACACT Veh2_AAACCTGGTCCCTTGT Veh2_AAACCTGTCAAAGACA
VEH                   VEH                   VEH                   VEH
Veh2_AAACCTGTCGCCAGCA Veh2_AAACGGGAGAGTGACC
VEH                   VEH
Levels: VEH IMQ


So it looks like theres no cluster information there, which I think s why im having this problem. So the question is, how do I also get that data over to Idents() in order to use it?

If it helps, the cluster information is appended in meta.data in a column called seurat_clusters

0
Entering edit mode

You can use Idents(AllCells.combined) <- AllCells.combined\$seurat_clusters to set the clusters as the Idents.

0
Entering edit mode

sorry im new to this thanks for your input!

0
Entering edit mode
21 months ago
tdfyoder ▴ 40

Check out the example (below) in FindMarkers doc: https://rdrr.io/cran/Seurat/man/FindMarkers.html

Trying setting ident.1= "1", group.by="cluster", and subset.ident="VEH". This will give you markers for the VEH treatment, run gain for subset.ident="IMQ", for IMQ treatment markers.

markers <- FindMarkers(pbmc_small, ident.1 = "g1", group.by = 'groups', subset.ident = "2")