AnnData-Environment: AnnData environment

AnnData-EnvironmentR Documentation

AnnData environment

Description

The Python environment used by zellkonverter for interfacing with the anndata Python library (and H5AD files) is described by the dependencies in returned by AnnDataDependencies(). The zellkonverterAnnDataEnv() functions returns the basilisk::BasiliskEnvironment() containing these dependencies used by zellkonverter. Allowed versions of anndata are available in .AnnDataVersions.

Usage

.AnnDataVersions

AnnDataDependencies(version = .AnnDataVersions)

zellkonverterAnnDataEnv(version = .AnnDataVersions)

Arguments

version

A string giving the version of the anndata Python library to use. Allowed values are available in .AnnDataVersions. By default the latest version is used.

Format

For .AnnDataVersions a character vector containing allowed anndata version strings.

Details

Using Python environments

When a zellkonverter is first run a conda environment containing all of the necessary dependencies for that version with be instantiated. This will not be performed on any subsequent run or if any other zellkonverter function has been run prior with the same environment version.

By default the zellkonverter conda environment will become the shared R Python environment if one does not already exist. When one does exist (for example when a zellkonverter function has already been run using a a different environment version) then a separate environment will be used. See basilisk::setBasiliskShared() for more information on this behaviour. Note the when the environment is not shared progress messages are lost.

Development

The AnnDataDependencies() function is exposed for use by other package developers who want an easy way to define the dependencies required for creating a Python environment to work with AnnData objects, most typically within a basilisk context. For example, we can simply combine this vector with additional dependencies to create a basilisk environment with Python package versions that are consistent with those in zellkonverter.

If you want to run code in the exact environment used by zellkonverter this can be done using zellkonverterAnnDataEnv() in combination with basilisk::basiliskStart() and/or basilisk::basiliskRun(). Please refer to the basilisk documentation for more information on using these environments.

Value

For AnnDataDependencies a character vector containing the pinned versions of all Python packages to be used by zellkonverterAnnDataEnv().

For zellkonverterAnnDataEnv a basilisk::BasiliskEnvironment() containing zellkonverter's AnnData Python environment.

Author(s)

Luke Zappia

Aaron Lun

Examples

.AnnDataVersions

AnnDataDependencies()
AnnDataDependencies(version = "0.7.6")

cl <- basilisk::basiliskStart(zellkonverterAnnDataEnv())
anndata <- reticulate::import("anndata")
basilisk::basiliskStop(cl)

theislab/zellkonverter documentation built on Oct. 24, 2024, 7:43 a.m.