Skip to contents

Convert an anndata object to a seurat object using reticulate

Usage

adata_to_srt(adata)

Arguments

adata

a connected python anndata object.

Examples

data("pancreas_sub")
adata <- srt_to_adata(pancreas_sub)
#> 'misc' slot is not converted.
#> 'tools' slot is not converted.
adata <- RunPAGA(adata = adata, group_by = "SubCellType", linear_reduction = "PCA", nonlinear_reduction = "UMAP")
srt <- adata_to_srt(adata)
#> Error in slot(object = object, name = "features")[[layer]] <- features: more elements supplied than there are to replace
srt
#> Error in eval(expr, envir, enclos): object 'srt' not found

### Or convert a h5ad file to Seurat object
# library(reticulate)
# check_Python("scanpy")
# sc <- import("scanpy")
# adata <- sc$read_h5ad("pancreas.h5ad")
# srt <- adata_to_srt(adata)
# srt