dviraran / SingleR

SingleR: Single-cell RNA-seq cell types Recognition (legacy version)
GNU General Public License v3.0
275 stars 98 forks source link

CreateSinglerObject: Annotation File 'names' attribute does not match colnames(counts) #67

Open reyesj opened 5 years ago

reyesj commented 5 years ago

Hi,

I'm running SingleR on a 10X experiment processed with Seurat 3.0 and I may have identified a bug. I created a counts matrix:

counts.table <- GetAssayData(object = bm.sctransform, slot = "counts"))

and the corresponding annotation:

annot.table <- bm.sctransform@meta.data

I receive the following error when using CreateSinglerObject or 'CreateSinglerSeuratObject`:

CreateSinglerSeuratObject(counts.table, annot=annot.table project.name='BM_HET-HET', min.genes = 500, technology = "10X", species = "Mouse", citation='',numCores = 4)

Error in names(orig.ident) <- colnames(counts) : 'names' attribute must be the same length as the vector

This issue is solved when I designate annot as a path rather than a matrix:

CreateSinglerSeuratObject(counts.table, annot='190603_bm_het-het_metaData.txt', project.name='BM_HET-HET', min.genes = 500, technology = "10X", species = "Mouse", citation='',numCores = 4)

I noticed the ReadSingleCellData function in SingleR may be reading names as column names leading to different length vectors.

Screenshot 2019-06-03 12 32 52

dviraran commented 5 years ago

Hi,

As of now, the annot field only takes a vector. Use bm.sctransform@meta.data$orig.ident and it should work...

Best, Dvir