I have a seurat object called AllCells.combined, and I wish to identify within the object all the cells that have expression of gene "Ighm" > 0; and also identify all cells that have expression of "Ighm" = 0
An easy way to do this would be to append it to the meta.data but I can't quite get it.
I tried:
AllCells.combined$IGHMPOS <- WhichCells(AllCells.combined, expression = Ighm > 0)
and got this error: Error: Cannot add more or fewer cell meta.data information without values being named with cell names
I then tried this:
AllCells.combined$IGHMPOS <- AllCells.combined["Ighm" > 0, ]
and got this error:
Error in [.Seurat(AllCells.combined, "Ighm" > 0, )
Incorrect number of logical values provided to subset features`
I know its something simple Im missing
Thanks in advance!
@atakanekiz, your answer is good but the second line is missing a " " " character after "IGHM_NEG" and has a ")" too many. Most probably a typo, the right answer should read:
Cheers!
Good catch, fixed it now.