This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Exporting Raw counts into .csv file from seurat object

Hi All,

I need to save Raw counts into .csv file from my Seurat object, I have tried the following code but it is not working for me

expr_raw <- GetAssayData(object = alldata, assay.type = "RNA", slot = "counts")
expr <- as(Class = 'matrix', object = expr_raw)

It gives the following error

Error in asMethod(object) : 
  Cholmod error 'problem too large' at file ../Core/cholmod_dense.c, line 105

Kindly help me to save the raw counts from my Seurat object into a CSV file.

thanks a lot and have a great day ahead,

Dave

seurat raw counts csv

Hey Dave, strange error message, but it seems to have been reported a lot. Can you check the other queries about it via your search engine of choice and then report back here to help us?

1 answer

Hi there,

This is how I do it. Hope it helps

write.table(as.matrix(GetAssayData(object = seurat.obj, slot = "counts")), 
            '/your/path/to/store/csv/counts.csv', 
            sep = ',', row.names = T, col.names = T, quote = F)

Thank you for posting the soluation

thank you. it worked but it provides the counts per cell per ADT and I do not know how to have those counts per conditions or per sample. would highly appreciate any help .

Log in to answer this question.