Skip to contents

Export SeuratObject to Other Formats.

Usage

ExportSeurat(
  seu.obj,
  assay = NULL,
  reduction = NULL,
  to = c("SCE", "AnnData", "CellDataSet", "cell_data_set", "loom"),
  anndata.file = NULL,
  loom.file = NULL,
  conda.path = NULL,
  ...
)

Arguments

seu.obj

A seurat object.

assay

Which assay to use. Default: NULL (get with DefaultAssay).

reduction

Name of DimReduc to set to main reducedDim in cds.

to

The target format, chosen from "SCE" (SingleCellExperiment), "AnnData", "CellDataSet", "cell_data_set", "loom". Default: "SCE".

anndata.file

File used to save AnnData results. Default: NULL.

loom.file

File used to save loom results. Default: NULL.

conda.path

Conda environment path, used when to is "AnnData". Default: NULL.

...

Parameter for as.SingleCellExperiment, sceasy::convertFormat, as.CellDataSet, as.cell_data_set, SaveLoom, corresponding to to.

Value

Object corresponding to to.

Examples

if (FALSE) {
library(Seurat)
# export to SingleCellExperiment
sce.obj <- ExportSeurat(seu.obj = pbmc_small, assay = "RNA", to = "SCE")
# export to CellDataSet
cds.obj <- ExportSeurat(seu.obj = pbmc_small, assay = "RNA", reduction = "tsne", to = "CellDataSet")
# export to cell_data_set
cds3.obj <- ExportSeurat(seu.obj = pbmc_small, assay = "RNA", to = "cell_data_set")
# export to AnnData, need users to provide the conda path and the output file
ExportSeurat(
  seu.obj = pbmc_small, assay = "RNA", to = "AnnData", conda.path = "/path/to/anaconda3",
  anndata.file = "/path/to/pbmc_small.h5ad"
)
# export to loom, need users to provide the output file
ExportSeurat(
  seu.obj = pbmc_small, assay = "RNA", to = "loom",
  loom.file = "/path/to/pbmc_small.loom"
)
}