Merging subsets in Seurat after SCTransform
0
0
Entering edit mode
7 weeks ago

Hi everyone,

I am having trouble with an issue, and couldn't find a solution. Briefly, I have an integrated Seurat object (WT and Treat samples) that been processed by the SCT function. I wanted to subset cells expressing certain genes at a high and low level based on a threshold. Then, when I want to merge these two subclusters, it gives an error as below.

sample.integrated <- readRDS("~/Desktop/Seurat_Combined.rds")

new.cluster.ids <- c("I", "S","RC","DC","CS","KO","CS","H","uC","RC","MC","MC","DC","H")
names(new.cluster.ids) <- levels(sample.integrated)
sample.integrated <- RenameIdents(sample.integrated, `0` = "I", `1` = "S", `2` = "RC", 
                                  `3` = "DC", `4` = "CS", `5` = "KO", `6` = "CS", `7` = "H", 
                                  `8` = "uC", `9` = "RC", `10` = "MC", `11` = "MC", 
                                  `12` = "DC", `13` = "H")

DefaultAssay(sample.integrated) <- "RNA"
sample.integrated <- NormalizeData(sample.integrated, verbose = FALSE)

summary(FetchData(object = sample.integrated, vars = "Nasp"))
summary(FetchData(object = sample.integrated, vars = "Tomm5"))

NT_High <- subset(sample.integrated, subset = Nasp > 1.6 & Tomm5 > 0.5)   
NT_Low <- subset(sample.integrated, subset = Nasp < 0.83 & Tomm5 < 0.3)

p1 <- DimPlot(NT_High, reduction = "umap", group.by = "stim", pt.size = 0.4, cols = c("blue", "pink"))
p2 <- DimPlot(NT_High, reduction = "umap", label = T, label.size = 4, repel = T, pt.size = 0.4)
plot_grid(p1, p2)

p3 <- DimPlot(NT_Low, reduction = "umap", group.by = "stim", pt.size = 0.4, cols = c("blue", "pink"))
p4 <- DimPlot(NT_Low, reduction = "umap", label = T, label.size = 4, repel = T, pt.size = 0.4)
plot_grid(p3, p4)

NT.integrated <- merge(x = NT_High, y = NT_Low, add.cell.ids = c("High", "Low"), project = "MyProject")

   Error in `.rowNamesDF<-`(x, value = value) : 
  duplicate 'row.names' are not allowed

Until creating the Dimplots, it works well. My question is how I can merge these two clusters? Then I'll use the merged object for DEG analyses between the defined high and low cells.

If I were able to create a merged object (such as NT.integrated), I was going to run these functions:

DEG1 <- FindMarkers(NT.integrated, ident.1 = "High", ident.2 = "Low", assay = "RNA", logfc.threshold = 0.25, test.use = "MAST", only.pos = F)

This is just simply to see which genes are enriched in high or low expression conditions.

and

DEG2 <- FindMarkers(NT.integrated, ident.1 = "KO_High", ident.2 = "KO_Low", assay = "RNA", logfc.threshold = 0.25, test.use = "MAST", only.pos = F)

This 2nd one is regarding finding DEGs between cell clusters from high and low subsets. Btw, is that also possible to rename the idents in each subset by giving them High_clustername and Low_clustername prefixes (after merging)?

I hope it is clear. Thanks for your help.

seurat subset sctransform merge DEGs • 153 views
ADD COMMENT

Login before adding your answer.

Traffic: 2507 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6