Entering edit mode
3.0 years ago
bioneer
▴
40
Hi Biostars,
I have some prefiltered scRNAseq count data and want to extract counts for cells belonging to a specific cluster.
The following code retrieves the counts with gene symbols by default:
cluster01 <- subset(data_integrated,idents = c("Cluster 1"))
cluster01_counts <- cluster01@assays$RNA@counts
The output looks like this (column names truncated):
X1 AAAC.. AAAC.. AAAC..
A1BG 0 0 3
A1CF 0 0 0
Column X1 contains gene symbols.
Is there a way to extract ENSEMBL IDs directly instead of gene symbols?
Thank you, fracarb8, your solution works very well! Thank you also for the hint to remove duplicated genes when converting to row names.