seurat icon indicating copy to clipboard operation
seurat copied to clipboard

Remove HTO with few counts - solving "Cells with zero counts exist as a cluster"

Open SigneDK opened this issue 9 months ago • 1 comments

Hi all, I have encountered an issue, trying to demultiplex my samples. I have 4 different HTO, where one of them is only detected on 6 cells, which I assume is why I get the error "Cells with zero counts exist as a cluster". I have looked into the suggestions from #2549, #5640, and #4435, and tried all but remove the HTOs with few counts, but I can't figure out how to do this.

Below is my demultiplexing code:

#Normalize data
Seurat.object<- NormalizeData(Seurat.object)

rowSums(Seurat.object[["HTO"]]$counts)   #Check if all HTO are in use
any(Seurat.object$nCount_HTO == 0)       #Any cells without a HTO? 

#remove cells with 0 HTO
Seurat.object_HTO <- subset(Seurat.object, subset = nCount_HTO > 0) 

#Demultiplex
Seurat.object_demulti<- HTODemux(Seurat.object_HTO, assay = "HTO", positive.quantile = 0.99)

Thanks!

SigneDK avatar Apr 29 '24 21:04 SigneDK

You can try removing the HTO with few counts that's only detected in 6 cells by removing the row for that HTO from the original counts matrix before creating your HTO assay.

cdalgarno avatar May 03 '24 18:05 cdalgarno

Hi, Many thanks to @cdalgarno for helping. As suggested, please consider removing that specific HTO. You can do it by re-create a new HTO assay object by using CreateAssayObject() function. For example:

hto_matrix = Seurat.object@assays$HTO
hto_matrix = hto_matrix[-4, ]  # this step is to remove the unwanted HTO 
hto_assay_new = CreateAssayObject(counts = hto_matrix)
Seurat.object[['HTO_new']] = hto_assay_new 

And you can perform analyses like HTODemux() on the "HTO_new" assay instead.

longmanz avatar Jun 24 '24 15:06 longmanz