This is a test version of Biostars. For the public version, visit https://www.biostars.org.
scRNAseq analysis - h5ad file conversion to Seurat format

Hi all. I have a single .h5ad file that contains scRNAseq data from several samples. I would like to convert it so that I can open it in Seurat (I am comfortable with R, but not with Python). I have found the following R package that is supposed to do it (SeuratDisk). The process is as follows:

library(SeuratDisk)
library(Seurat)

Convert("RNA_seq_dataset.h5ad", ".h5seurat", overwrite= TRUE)

The output from this chunk is:

Unknown file type: h5ad'assay' not set, setting to 'RNA'Creating h5Seurat file for version 3.1.5.9900
Adding X as scale.data
Adding raw/X as data
Adding raw/X as counts
Adding meta.features from raw/var
Adding X_pca as cell embeddings for pca
Adding X_umap as cell embeddings for umap

Then, when I try to read the converted file, things go wrong:

seuratObject <- LoadH5Seurat("RNA_seq_dataset.h5seurat")
Validating h5Seurat file
Error: Cannot find dataset with cell names

Has anyone else analysed a .h5ad file in Seurat, and if so, how did you do it? Thank you!

conversion scrnaseq scanpy seurat seuratdisk

Maybe try assays="SCT"? - here is the documentation for reference

1 answer

You can try to use the adata_to_srt function of SCP package (https://github.com/zhanghao-njmu/SCP)

library(SCP)
library(reticulate)
sc <- import("scanpy")
adata <- sc$read_h5ad("pancreas.h5ad")
srt <- adata_to_srt(adata)
srt

Log in to answer this question.