Seurat: Duplicate cell names when running CCA

Created on 18 Aug 2017  路  4Comments  路  Source: satijalab/seurat

Hello,

My data has the same cell barcode in both objects. I'm wondering if there is an easy way to rename the cells by appending a label before aligning, like the 'add.cell.id1' option in MergeSeurat?

The error:

N2s <- RunCCA(object = N2_1, object2 = OH_1, group.by = "sample", scale.data = TRUE, rescale.groups = TRUE)
Running CCA
Merging objects
Error in MergeSeurat(object1 = object, object2 = object2, do.scale = FALSE, :
Duplicate cell names, please provide 'add.cell.id1' and/or 'add.cell.id2' for unique names

Thanks so much

Most helpful comment

I use 10x datas so before calling CreateSeuratObject(), I change the colnames of my two matrix:

pbmc.data_firstProject <- Read10X(data.dir = "~/Downloads/first/filtered_gene_bc_matrices/hg19/")
colnames(pbmc.data_firstProject) = paste0("firstProject_", colnames(pbmc.data_firstProject) )
pbmc_firstProject <- CreateSeuratObject(raw.data = pbmc.data_firstProject, min.cells = 3, min.genes = 200, project = "10X_PBMC_first")

pbmc.data_secondProject <- Read10X(data.dir = "~/Downloads/second/filtered_gene_bc_matrices/hg19/")
colnames(pbmc.data_secondProject) = paste0("secondProject_", colnames(pbmc.data_secondProject) )
pbmc_secondProject <- CreateSeuratObject(raw.data = pbmc.data_secondProject, min.cells = 3, min.genes = 200, project = "10X_PBMC_second")

All 4 comments

I use 10x datas so before calling CreateSeuratObject(), I change the colnames of my two matrix:

pbmc.data_firstProject <- Read10X(data.dir = "~/Downloads/first/filtered_gene_bc_matrices/hg19/")
colnames(pbmc.data_firstProject) = paste0("firstProject_", colnames(pbmc.data_firstProject) )
pbmc_firstProject <- CreateSeuratObject(raw.data = pbmc.data_firstProject, min.cells = 3, min.genes = 200, project = "10X_PBMC_first")

pbmc.data_secondProject <- Read10X(data.dir = "~/Downloads/second/filtered_gene_bc_matrices/hg19/")
colnames(pbmc.data_secondProject) = paste0("secondProject_", colnames(pbmc.data_secondProject) )
pbmc_secondProject <- CreateSeuratObject(raw.data = pbmc.data_secondProject, min.cells = 3, min.genes = 200, project = "10X_PBMC_second")

We've added support for this scenario (#129) on the develop branch if you want to try that out. You can now give parameters to RunCCA that get passed on to MergeSeurat (such as add.cell.id1).

Hi,
for some reason the add.cell.id1 and 2 strings are pasted to all of slots storing the cell names BUT the [email protected]. Also, if I match the cca names with the [email protected] they're not sorted ?
If I run mergeSeurat the names are correct.

my code is

HLA.cca<-RunCCA(HLA.pos,HLA.neg,genes.use = hgv.union,
group1 =unique(HLA.pos@ident),group2 =unique(HLA.neg@ident),
add.cell.id1="pos", add.cell.id2="neg")
all.equal(attr(HLA.cca@[email protected], "dimnames")[[1]],gsub("neg_","",gsub("pos_","", [email protected])))
is.unsorted(match(attr(HLA.cca@[email protected], "dimnames")[[1]] , gsub("neg_","",gsub("pos_","", [email protected])) ))

(ah. I think I know the answer to the second question. it's the barcodes shared by both the datasets that are matched twice.)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tmccra2 picture tmccra2  路  3Comments

igordot picture igordot  路  3Comments

camilliano picture camilliano  路  3Comments

sarahwajid picture sarahwajid  路  3Comments

fly4all picture fly4all  路  3Comments