ident function in sce
1
0
Entering edit mode
@reinepapillon-23492
Last seen 3.9 years ago

Hello! I have identified 4 clusters in my sce object and would like to know the cell IDs in a particular cluster. I know the > table(sce$clusters) command shows me the number of cells in each cluster, however I can't work out how to see the cell IDs. Anyone know? In Seurat I use >head(Idents(x), 10) and it will show the first 10 cell IDs in 'x' with the cluster number next to them. Would love something like this with my sce object! Thanks for your help!!!

SingleCellExperiment cluster identities sce • 1.8k views
ADD COMMENT
1
Entering edit mode
Aaron Lun ★ 28k
@alun
Last seen 7 minutes ago
The city by the bay

This is pretty straightforward.

# Making up a SCE with some made-up clusters:
library(scater)
sce <- mockSCE()
sce$cluster <- sample(LETTERS, ncol(sce), replace=TRUE) 

# Get a specific cluster's IDs:
colnames(sce)[sce$cluster=="A"]
## [1] "Cell_008" "Cell_018" "Cell_045" "Cell_073" "Cell_086" "Cell_125" "Cell_138"
## [8] "Cell_162"

# Show everything in a data frame:
colData(sce)[,"cluster",drop=FALSE]
## DataFrame with 200 rows and 1 column
##              cluster
##          <character>
## Cell_001           Y
## Cell_002           Z
## Cell_003           C
## Cell_004           N
## Cell_005           O
## ...              ...
## Cell_196           W
## Cell_197           L
## Cell_198           B
## Cell_199           J
## Cell_200           E
ADD COMMENT
0
Entering edit mode

Thank you so much!!! Really appreciate the help! :-)

ADD REPLY

Login before adding your answer.

Traffic: 471 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6