Subsetting - Raw Counts from Seurat Object
0
0
Entering edit mode
11 months ago
David_emir ▴ 390

Hi All,

I am working on Single-cell dataset, I wanted to extract raw counts of clusters (Say cluster num 4,6,8) and save it as a csv file. but I am not able to do the same, I have used the following codes,

alldata_epi <- subset(alldata, idents = c(1,23,5,18,22,15))
counts <- alldata_epi@assays$RNA@counts

but when I check the counts, it is not showing anything,

> counts
     [,1]
[1,]   NA
>

Please let me know where I am going wrong.

Thanks and regards,

Dave

seurat raw counts RNA-Seq • 3.2k views
ADD COMMENT
0
Entering edit mode

Ok, I just checked that it should have worked. Did you check the subsetted object to see if there are some errors?

table(alldata$seurat_clusters)
table(alldata_epi$seurat_clusters)

This will show you if number of cells are same in selected clusters after subsetting.

Then, when you get the counts object, check its dimension?

dim(count)

Could you post these outputs?

ADD REPLY
0
Entering edit mode

Thanks a lot for the reply, i just checked its shows the following

> counts <- alldata@assays$RNA@counts
     [,1]
[1,]   NA
> dim(counts)
[1] 22294   780
ADD REPLY
1
Entering edit mode

Ok, it seems you have NA in your original data also, so it is not coming from subsetting.

check your counts in the sparse matrix.

alldata@assays$RNA@counts[1:10,1:20]
alldata_epi@assays$RNA@counts[1:10,1:20]

my sparse matrix looks like this

AL512413.1 . . . . . . . . . . . . . . . . . . . .
MEGF6      . 1 . 1 1 1 . . . . . 1 . . . . . . . .
TPRG1L     . . . . . . . . . . . . . . . . 1 . . .
WRAP73     1 . . 1 . 2 1 2 . . . . . 1 . . . 1 . .
TP73       . . . . . . . . . . . . . . . . . . . .
CCDC27     . . . . . . . . . . . . . . . . . . . .
SMIM1      . . . . . . 2 . . . . . . . . . . . . .
LRRC47     . . . . . . 2 1 3 1 1 1 . . . . . . 2 .
CEP104     2 1 . . . . . . . . . . . . . . . . 1 .
DFFB       . . . . . . . . . . . . . . . . . . . .
C1orf174   1 2 1 . 1 . 1 . . . 1 . . . . 1 . . . .
ADD REPLY

Login before adding your answer.

Traffic: 2071 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