Convert a Seurat object to .h5ad file
3
2
Entering edit mode
2.4 years ago
gaelgarcia05 ▴ 270

Hi,

I'm trying to build a single-cell browser using cellxgene from the Chan-Zuckerberg Intiative. However, I need to have a .h5ad file from the annpdata ackage in Python. I've done all my analysis in R, mainly using Seurat.

I was wondering if there's a way to convert a Seurat object to .h5ad within R. Seurat team seems to be working on this but as of Aug 2019 it's non-functional.

Thanks.

single-cell RNA-Seq seurat R scanpy • 10k views
5
Entering edit mode
2.4 years ago

Looks like the way to do it is to write to loom format via loomR, then read that into anndata to be written as an .h5ad file.

Single cell folks need to a pick a file format/structure and stick with it.

EDIT (02/05/2021): The recent zellkonverter package from Bioc provides an easier way to do this.

3
Entering edit mode

Could not have said it better. Thanks!

2
Entering edit mode
2.4 years ago
shoujun.gu ▴ 360

The best way now is to manually create your h5ad from seurat objects, such as put all normalized value as adata.X , raw counts to adata.raw, all gene annotations to adata.var and all cell annotations to adata.obs, etc

Or use scanpy from the very beginning.

1
Entering edit mode
2.0 years ago
mmfiruleva ▴ 10

In R, you can convert Seurat object to h5ad and vice versa using sceasy.