This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to show their orig.ident after Merging Seurat objects TWICE ?

Please some smart brain help me!

I have three experimental groups and each group contains 3, 5, 3 PBMC sc RNA sequencing samples.

I want to draw a UMAP plot with those results.

My first trial was merging by each group for example

Group1 <- merge(1_1, y = c(1_2, 1_3), add.cell.ids = c("1_1", "1_2", "1_3"), project = "Group_1")
Group2 <- merge(2_1, y = c(2_2, 2_3, 2_4, 2_5), add.cell.ids = c("2_1", "2_2", "2_3", "2_4", "2_5"), project = "Group_2")
Group3 <- merge(3_1, y = c(3_2, 3_3), add.cell.ids = c("3_1", "3_2", "3_3"), project = "Group_3")

then merged again those three groups

Combined <- merge(Group_1, y = c(Group_2, Group_3), add.cell.ids = c("group1", "group2", "group3"), project = "group_all")

And I generated UMAP plot of 'Combined', but I could not label them or separate them by the original origin such as 1_1, 1_2, 1_3, 2_1, 2_2 ,etc. It just showed by Group1, Group2, Group3.

How can I plot combined UMAP with labeling by group and also by original sample?

schematic view

seurat r merge scrna

The metadata will still contain a column orig.ident after merging that will contain the original sample identities. To make a UMAP plot using this the code would look something like this DimPlot(seu, group.by="orig.ident").

Thank you for your comment.

But that is what I already tried and "orig.ident" after merging twice shows only the second merged groups, 'group1, group2, group3' not '1_1', '1_2', '1_3', '2_1', '2_2' ~~ '3_3'.

R variables can't start with numbers, so let's assume your 1_1 variable is original_group_1. Just add a metadata column to each sample with this identity, so like original_group_1$identity <- "1_1".

0 answers

No answers yet.

Log in to answer this question.