Convert SeuratObject to AnnData using SeuratDisk/sceasy/scDIOR.
Usage
Seu2AD(
seu.obj,
method = c("SeuratDisk", "sceasy", "scDIOR"),
out.folder = NULL,
out.filename = NULL,
assay = "RNA",
slot = "counts",
save.scale = FALSE,
conda.path = NULL
)
Arguments
- seu.obj
A seurat object.
- method
Method used to perform conversion, choose from "SeuratDisk", "sceasy", "scDIOR". Default: "SeuratDisk".
- out.folder
Output folder. Default: NULL (current working directory).
- out.filename
Output file name, e.g., test.h5ad. Default: NULL (
seu.obj
name, method, h5ad.).- assay
Assay name to store expression matrices in SeuratObject. Default: RNA.
- slot
Slot for adata.X, used when
method
is "sceasy". Default: counts.- save.scale
Logical value, whether to save scaled count matrix, used when
method
is "SeuratDisk", "scDIOR". Default: FALSE. Whenmethod
is "SeuratDisk" andsave.scale
is TRUE (FALSE), scaled data is stored in X, log-normalized data is in raw.X (log-normalized data is stored in X,raw count matrix is in raw.X); Whenmethod
is "scDIOR" andsave.scale
is TRUE (FALSE), scaled data is stored in X,log-normalized data is in raw.X, raw count matrix is in layers (log-normalized data is stored in X,raw count matrix is in layers).- conda.path
Conda environment path, used when
method
is "sceasy". Default: NULL.
Examples
# SeuratDisk
Seu2AD(seu.obj = pbmc3k.final, method = "SeuratDisk", out.folder = "benchmark", assay = "RNA", save.scale = TRUE)
#> Error in Seurat::GetAssayData(object = seu.obj, slot = "scale.data", assay = assay): object 'pbmc3k.final' not found
# sceasy
Seu2AD(seu.obj = pbmc3k.final, method = "sceasy", out.folder = "benchmark", assay = "RNA", slot = "counts", conda.path = "/path/to/conda")
#> Error in reticulate::use_condaenv(conda.path, required = TRUE): Unable to locate conda environment '/path/to/conda'.
# scDIOR
Seu2AD(seu.obj = pbmc3k.final, method = "scDIOR", out.folder = "benchmark", assay = "RNA", save.scale = TRUE)
#> There is an error when using scDIOR: Error in seurat_write_h5(seurat = data, file = file, assay.name = assay.name, : object 'pbmc3k.final' not found
#> NULL