satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.29k stars 916 forks source link

`WhichCell()` for marker names with dashes from `ADT` assay returned error of `None of the requested variables were found`, even when using backticks #9411

Open denvercal1234GitHub opened 3 weeks ago

denvercal1234GitHub commented 3 weeks ago

Hi there,

I have a Seurat object with both RNA and ADT assay data.

Anyone has any input why WhichCells() failed to retrieve the cells using ADT markers?

DefaultAssay(gem_ID.list_MERGED) <- "ADT"
length(WhichCells(gem_ID.list_MERGED, expression = `CD185-(CXCR5)` > 0))
Error in `FetchData()`:
! None of the requested variables were found: 
Backtrace:
 1. SeuratObject::WhichCells(...)
 2. SeuratObject:::WhichCells.Seurat(...)
 4. SeuratObject:::FetchData.Seurat(...)

Pulling markers without dashes in the name worked fine.

Related #1212 #3219

denvercal1234GitHub commented 3 weeks ago

My current work-around is using GetAssayData followed by sum() -- not ideal but works.

##### tested on markers without dashes
SeuratObject::GetAssayData(object = gem_ID.list_MERGED, assay = "ADT", layer = "data")["CD25",] -> ADT_CD25
sum(ADT_CD25 > 0)