Convert a Seurat object to an AnnData object
Usage
srt_to_adata(
srt,
features = NULL,
assay_x = "RNA",
layer_x = "counts",
assay_y = c("spliced", "unspliced"),
layer_y = "counts",
reductions = NULL,
graphs = NULL,
neighbors = NULL,
convert_tools = FALSE,
convert_misc = FALSE,
prepare_env = TRUE,
verbose = TRUE
)Arguments
- srt
A
Seuratobject.- features
Optional vector of features to include in the anndata object. Default is all features in
assay_x.- assay_x
Assay to convert as the main data matrix in the anndata object.
- layer_x
Layer name for assay_x in the Seurat object.
- assay_y
Assays to convert as layers in the anndata object.
- layer_y
Layer names for the assay_y in the Seurat object.
- reductions
Character vector specifying which Seurat reductions to convert into
obsm. Default isNULL, which converts all available reductions.- graphs
Character vector specifying which Seurat graphs to convert into
obsp. Default isNULL, which converts all available graphs.- neighbors
Character vector specifying which Seurat neighbor objects to convert into
obsp. Default isNULL, which converts all available neighbor objects.- convert_tools
Whether to convert the tool-specific data.
- convert_misc
Whether to convert the miscellaneous data.
- prepare_env
Whether to prepare and validate the Scanpy Python environment before conversion. Set to
FALSEwhen a wrapper already prepared the environment and reticulate must keep the same binding.- verbose
Whether to print the message. Default is
TRUE.
Examples
if (FALSE) { # \dontrun{
data(pancreas_sub)
adata <- srt_to_adata(pancreas_sub)
adata
# Or save as a h5ad/loom file
adata$write_h5ad(
"pancreas_sub.h5ad"
)
adata$write_loom(
"pancreas_sub.loom",
write_obsm_varm = TRUE
)
} # }