Package 'GCSanndataR'

Title: Google Cloud Storage-Backed AnnData for R
Description: Extends the 'anndataR' package to provide Google Cloud Storage-backed AnnData functionality for R. This package allows users to work with AnnData objects stored in Google Cloud Storage without downloading the entire file, enabling efficient access to large single-cell datasets directly from the cloud.
Authors: Masahiro Kanai
Maintainer: Masahiro Kanai <[email protected]>
License: MIT + file LICENSE
Version: 0.1.1
Built: 2026-06-04 07:02:30 UTC
Source: https://github.com/mkanai/GCSanndataR

Help Index


Install the gcs_anndata Python package

Description

This function installs the gcs_anndata Python package using reticulate. The gcs_anndata package allows for reading AnnData objects directly from Google Cloud Storage.

Usage

install_gcs_anndata(...)

Arguments

...

Additional arguments passed to reticulate::py_install()

Value

Invisible NULL, called for side effect of installing the package

See Also

py_install for more details on installation options

Examples

## Not run: 
install_gcs_anndata()

## End(Not run)

Read H5AD

Description

Read data from a H5AD file, either from a local file or from Google Cloud Storage

Usage

read_h5ad(
  path,
  as = c("HDF5AnnData", "InMemoryAnnData", "SingleCellExperiment", "Seurat"),
  mode = c("r", "r+", "a", "w", "w-", "x"),
  ...
)

Arguments

path

Path to the H5AD file to read. If the path starts with "gs://", it will be treated as a Google Cloud Storage path and will automatically use the GCSAnnData backend.

as

The type of object to return. Must be one of: "HDF5AnnData", "InMemoryAnnData", "GCSAnnData", "SingleCellExperiment", "Seurat". Default is "HDF5AnnData". Note that for paths starting with "gs://", this parameter is ignored and "GCSAnnData" is used. A warning will be issued if a different value is provided for GCS paths.

mode

The mode to open the HDF5 file. Default is "r" (read-only). Note that for paths starting with "gs://", this parameter is ignored and read-only mode is used. A warning will be issued if a different value is provided for GCS paths.

* 'a' creates a new file or opens an existing one for read/write. * 'r' opens an existing file for reading. * 'r+' opens an existing file for read/write. * 'w' creates a file, truncating any existing ones. * 'w-'/'x' are synonyms, creating a file and failing if it already exists.

...

Extra arguments provided to 'adata$to_SingleCellExperiment()' or 'adata$to_Seurat()'. See [AnnData()] for more information on the arguments of these functions. Note: update this documentation when ['r-lib/roxygen2#955'](https://github.com/r-lib/roxygen2/issues/955) is resolved.

Value

The object specified by 'to'

Examples

## Not run: 
h5ad_file <- system.file("extdata", "example.h5ad", package = "anndataR")

# Read the H5AD as a SingleCellExperiment object
sce <- read_h5ad(h5ad_file, as = "SingleCellExperiment")

# Read the H5AD as a Seurat object
seurat <- read_h5ad(h5ad_file, as = "Seurat")

# Read an H5AD file from Google Cloud Storage
# This will automatically use GCSAnnData
gcs_adata <- read_h5ad("gs://my-bucket/my-file.h5ad")

# Access specific rows and columns
gcs_adata$X[1:10, 1:5]

# Access using names
gcs_adata$X[c("cell1", "cell2"), c("gene1", "gene2")]

## End(Not run)