ZarrArchive-class: Mange and import Zarr archives

ZarrArchiveR Documentation

Mange and import Zarr archives

Description

'ZarrArchive()' creates and _R_ object representing a Zarr archive.

'tree()' is invoked for the side effect of displaying the hierarchical groups represented in the archive.

'datasets()' returns an alphabetically sorted vector of groups subtending the archive represented by 'x'.

'dataset()' accesses the dataset 'name' from the object 'x'.

'$' provides access to named groups (datasets) in the archive. Tab completion is available.

‘as()' coerces the python object to it’s _R_ representation.

'show()' displays the resource (archive) path and tree of datasets (groups).

Usage

ZarrArchive(path)

tree(x)

datasets(x)

dataset(x, name)

## S4 method for signature 'ZarrArchive'
x$name

## S4 method for signature 'ZarrArchive'
show(object)

Arguments

path

'character(1)' file path to the top level of the Zarr archive.

x

a 'ZarrArchive()' instance.

name

'character(1)' name of dataset, satisfying 'name datasets(x)'.

object

A 'ZarrArchive' instance.

Value

'ZarrArchive()' returns an object representing the Zarr archive. The object can be queried for component parts, and the parts imported into _R_.

'tree()' returns the original object, invisibly.

'datasets()' returns a 'character()' vector of group names.

'dataset()' returns a python reference to the named dataset.

'$' returns a python representation of the dataset, or if pressed with '<tab>' possible completions matching the current prefix.

'as(from, "matrix")' returns a dense _R_ matrix representation of the python data.

Examples

fl <- system.file(
    package="ZarrExperiment", "extdata",
    "stahl-2016-science-olfactory-bulb.matrix.zarr"
)
arr <- ZarrArchive(fl)
arr

datasets(arr)

dataset(arr, "matrix")

arr$matrix

m <- as(arr$matrix, "matrix")
dim(m)
m[1:5, 1:5]

colData <- tibble::tibble(
    region_id = as(arr$region_id, "matrix"),
    x_region = as(arr$x_region, "matrix"),
    y_region = as(arr$y_region, "matrix")
)
colData


Bioconductor/ZarrExperiment documentation built on Oct. 9, 2024, 1:51 p.m.