Question: Subsetting - Raw Counts from Seurat Object
0
gravatar for David_emir
3 months ago by
David_emir370
India
David_emir370 wrote:

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

raw counts rna-seq seurat • 377 views
ADD COMMENTlink modified 3 months ago • written 3 months ago by David_emir370

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 REPLYlink modified 3 months ago • written 3 months ago by piyushjo520

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 REPLYlink written 3 months ago by David_emir370

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 REPLYlink written 3 months ago by piyushjo520
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: 1113 users visited in the last hour