Question: appending information to seurat object meta.data
1
gravatar for cook.675
12 months ago by
cook.67540
cook.67540 wrote:

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!

seurat scrna • 1.9k views
ADD COMMENTlink modified 5 months ago by atakanekiz250 • written 12 months ago by cook.67540
0
gravatar for atakanekiz
5 months ago by
atakanekiz250
atakanekiz250 wrote:

Try using an ifelse approach.

poscells <- WhichCells(AllCells.combined, expression = Ighm > 0)

AllCells.combined$IGHM_status <- ifelse(colnames(AllCells.combined) %in% poscells, "IGHM_POS", "IGHM_NEG))
ADD COMMENTlink written 5 months ago by atakanekiz250
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2091 users visited in the last hour