## ----setup, include=FALSE----------------------------------------------------- library(BiocStyle) ## ----install, eval=FALSE------------------------------------------------------ # if (!require("BiocManager", quietly=TRUE)) # install.packages("BiocManager") # BiocManager::install("ZarrArray") ## ----load, message=FALSE------------------------------------------------------ library(ZarrArray) ## ----construction------------------------------------------------------------- zarr_path <- system.file(package="Rarr", "extdata", "zarr_examples", "column-first", "int32.zarr") A <- ZarrArray(zarr_path) A ## ----check_class-------------------------------------------------------------- class(A) is(A, "DelayedArray") ## ----basic_ops---------------------------------------------------------------- dim(A) length(A) A[1:5, , 1] aperm(A) max(A) sum(A) A - 0.5 A^3 A == 0L sqrt(A) ## ----other_ops---------------------------------------------------------------- path(A) type(A) chunkdim(A) a <- as.array(A) ## ----writeZarrArray_1--------------------------------------------------------- path1 <- tempfile(fileext=".zarr") writeZarrArray(A, path1, chunkdim=c(3, 5, 2)) ## ----writeZarrArray_2--------------------------------------------------------- path2 <- tempfile(fileext=".zarr") A2 <- sqrt(t(A[ , , 1]) + 1) # all these operations are delayed writeZarrArray(A2, path2) # realizes the delayed operations block by block ## ----session_info------------------------------------------------------------- sessionInfo()