This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to compare two Seurat object (sample) in order to find top markers?

Hello,

I have merged two Seurat object, they are not technical replicate, in fact they are different sample types. I have done integration using IntegrateData function in Seurat4.

I have a question, how can I find top markers between two Seurat object, because they seems not really close even in phenotype, and worth to find their top markers.

I have put label for each sample and try to use group.by in FindMarkers but not worked.

Thanks.

scrna-seq ngs rna-seq

1 answer

I'm not sure I completely understand your question but I suggest your merge your two Seurat objects with the following command:

merged <- merge(seurat1, seurat2, add.cell.ids = c("seurat1", "seurat2"), project = "merged_seurat")

Then, the information between which original seurat object are the cells coming from will be stocked in the seurat@meta.data in the orig.ident column.

You can rename your idents as your orig.ident in order to use your FindMarkers function:

Idents(object = merged) <- "orig.ident"

And then run:

markers_seurat1_vs_seurat2 <- FindMarkers(merged, ident.1 = "seurat1, ident.2 = "seurat2", method = "DESeq2")

(and choose the method you want)

Here's more information:

Seurat Cheat Sheet

Find markers by orig.ident

Hello

I have four samples (2 replicates each). I used your approach to identify marker genes in two group of samples in Seurat. Would it be possible to apply FindMarkers on merged object of four samples ?

I defined groups as CT and I and included in the ass.cell.ids as given below :

ss_new <- merge(x = data1, y = c(data2, data3,data4), add.cell.ids = c("CT", "CT", "I", "I"), project = "seurat")

Idents(object = ss_new) <- "orig.ident"

markers_Ct_I <- FindMarkers(ss_new, ident.1 = "CT", ident.2 ="I", method = "DESeq2")

But I am getting error to run

Error in WhichCells.Seurat(object = object, idents = ident.1) : Cannot find the following identities in the object: CT

First, I suggest you rename your two CTs and Is as CT.1 and CT.2 or something like this and the same for I, before merging your seurat objects. You can redefine then your idents by using the column "orig.ident" created in your new seurat object after merging. You can see it in your metadata ss_new@meta.data$orig.ident. To redefine your idents:

Idents(object = ss_new) <- "orig.ident"

After this, you'll be able to search you markers with FindMarkers(ss_new, ident.1 = "CT", ident.2 ="I", method = "DESeq2")

You can save your idents before doing this with the following method:

ss_new[["old.ident"]] <- Idents(object = ss_new)
ss_new <- StashIdent(object = ss_new, save.name = "old.ident") 

Log in to answer this question.