This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Merging previously merged object in Seurat

I have two Seurat objects that were made by merging of samples:

object1 <-merge(A, y=B, add.cell.ids=c("A","B"))
object2 <-merge(C, y=D, add.cell.ids=c("C","D"))

For each object I did all preprocessing, PCA, and clustering. Now I want to merge cluster 1 from object1 and cluster 3 from object2

cluster1<-subset(object1, ident=1)
cluster3<-subset(object2, ident=1)

clusters1_3<-merge(cluster1, y=cluster3, add.cell.ids=c("1","3"))

however, when I cluster the cluster1_3 object, it would cluster to A, B, C, D initial clusters. What am I doinng wrong?

scrna-seq seurat single-cell r rna-seq

1 answer

Well, I found the solution. Clustering creates seurat_clusters column in metadata and it messes up with a previous seurat_clusters came from cluster1 and cluster3. So, after merging cluster1 and cluster3, I renamed the seurat_clusters column to 'status'

clusters1_3@meta.data$status <- clusters1_3@meta.data$seurat_clusters

Then I used 'status' as orig.ident for downstream analysis

Log in to answer this question.