This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Converting hdf5 file to loom file

Hello, I am currently processing the single cell data. I have hdf5 file, however, I want the loom file for downstream analysis. Can anyone please suggest if there is a way to convert hdf5 to loom file format? Any help is highly appreciated. Thanks in advance.

single-cell python scvelo rna

2 answers

You can use Seurat and LoomExperiment or sceasy to convert hdf5 file into loom file.

library(Seurat)
library(sceasy)
library(reticulate)
library(LoomExperiment)

#Creating Seurat object
data <- Read10X_h5("filtered_feature_bc_matrix.h5") 
data <- CreateSeuratObject(counts=data, project="test_project") 

#Converting into SingleCellExperiment object
data.sce <- as.SingleCellExperiment(data)

#Converting SCE object into loom
data.loom <- SingleCellLoomExperiment(data.sce)

OR
sceasy::convertFormat(data.sce, from="sce", to="loom",
                       outFile='data.loom')

Thanks so much for your reply! It works for me

Hi,

Have you find a way to convert hdf5 file to loom file? Many thanks in advance!

Best, Mingxuan

Log in to answer this question.