Read data from a Zarr store
Arguments
- path
Path to the Zarr store to read
- as
The type of object to return. One of:
"InMemoryAnnData": Read the Zarr store into memory as anInMemoryAnnDataobject"ZarrAnnData": Read the Zarr store as anZarrAnnDataobject"SingleCellExperiment": Read the Zarr store as aSingleCellExperiment::SingleCellExperimentobject"Seurat": Read the Zarr store as aSeuratObject::Seuratobject
- mode
The mode to open the Zarr file.
acreates a new file or opens an existing one for read/write.ropens an existing file for reading.r+opens an existing file for read/write.wcreates a file, truncating any existing ones.w-/xare synonyms, creating a file and failing if it already exists.
- ...
Extra arguments provided to the
as_*conversion function for the object specified byas
See also
Other AnnData creators:
AnnData(),
as_AnnData(),
read_h5ad()
Examples
# Please use "example_v3.zarr.zip" for AnnData stored as Zarr version 3
zarr_dir <- system.file("extdata", "example_v2.zarr.zip", package = "anndataR")
td <- tempdir(check = TRUE)
unzip(zarr_dir, exdir = td)
zarr_store <- file.path(td, "example_v2.zarr")
# Read the Zarr as a SingleCellExperiment object
if (requireNamespace("SingleCellExperiment", quietly = TRUE)) {
sce <- read_zarr(zarr_store, as = "SingleCellExperiment")
}
# Read the Zarr as a Seurat object
if (requireNamespace("SeuratObject", quietly = TRUE)) {
seurat <- read_zarr(zarr_store, as = "Seurat")
}