Could not have said it better. Thanks!
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.
4 answers
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.
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.
But then how do you actually make the conversion?
You can also try to use the srt_to_adata function of SCP package (https://github.com/zhanghao-njmu/SCP)
library(SCP)
data("pancreas1k")
adata <- srt_to_adata(pancreas1k)
adata$write_h5ad("pancreas1k.h5ad")
Log in to answer this question.