Seurat: How to transform Seurat object to csv format

Created on 20 Apr 2018  路  6Comments  路  Source: satijalab/seurat

I am trying to do some secondary analysis of Seurat object in Granatum
How can i transform Seurat object to csv format?
I want filtered expression data to csv format...

Analysis Question

Most helpful comment

library(data.table)
data_to_write_out <- as.data.frame(as.matrix([email protected]))
fwrite(x = data_to_write_out, file = "outfile.csv")

All 6 comments

library(data.table)
data_to_write_out <- as.data.frame(as.matrix([email protected]))
fwrite(x = data_to_write_out, file = "outfile.csv")

Thanks, It worked!!!
In addition, the resulting csv file did not include row names.
I changed script to
fwrite(x = data_to_write_out, row.names = TRUE, file = "outfile.csv")

Thanks again for your kind and rapid answer
May I ask one additional question?

The resulting CSV files contains gene names as gene symbols such as "Ccl5".
How can I make CSV files containing gene names by ensemble ID?
Because several secondary analysis tools take input gene names by ensemble IDs..

The method @milescsmith specified uses the gene names in the Seurat object. We do not provide a database of Ensembl IDs; to convert your gene names to Ensembl IDs, you can either do this in R by matching your gene names to Ensembl IDs and changing the row names, or manually in your favorite CSV editor (eg. Excel). You could also create a Seurat object with Ensembl IDs instead of gene names, rerun your analysis, and write out the CSV from that new Seurat object.

I have a question concerning Seurat 3.

How can I create TSNE plot just based on list of genes. I have CSV file which contains around 2000 genes. I would like to extract only these genes from Seurat object and create TSNE base on new Seurat object (which contains all cells but only 2000 of Features).
Thanks for your help in advance

Is it possible to export the CSV with metadata as well?

Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kathirij picture kathirij  路  3Comments

akhst7 picture akhst7  路  3Comments

bio-la picture bio-la  路  3Comments

igordot picture igordot  路  3Comments

fly4all picture fly4all  路  3Comments