Skip to contents

Implementation of an in-memory AnnData object where data is stored within the R session. This is the simplest back end and will be most familiar to users. It is want you will want to use in most cases where you want to interact with an AnnData object.

See AnnData-usage for details on creating and using AnnData objects.

Value

An InMemoryAnnData object

See also

AnnData-usage for details on creating and using AnnData objects

Other AnnData classes: AbstractAnnData, AnnDataView, HDF5AnnData, ReticulateAnnData

Super class

anndataR::AbstractAnnData -> InMemoryAnnData

Active bindings

X

See AnnData-usage

layers

See AnnData-usage

obs

See AnnData-usage

var

See AnnData-usage

obs_names

See AnnData-usage

var_names

See AnnData-usage

obsm

See AnnData-usage

varm

See AnnData-usage

obsp

See AnnData-usage

varp

See AnnData-usage

uns

See AnnData-usage

Methods

Inherited methods


Method new()

Creates a new instance of an in-memory AnnData object. Inherits from AbstractAnnData.

Usage

InMemoryAnnData$new(
  X = NULL,
  obs = NULL,
  var = NULL,
  layers = NULL,
  obsm = NULL,
  varm = NULL,
  obsp = NULL,
  varp = NULL,
  uns = NULL,
  shape = NULL
)

Arguments

X

See the X slot in AnnData-usage

obs

See the obs slot in AnnData-usage

var

See the var slot in AnnData-usage

layers

See the layers slot in AnnData-usage

obsm

See the obsm slot in AnnData-usage

varm

See the varm slot in AnnData-usage

obsp

See the obsp slot in AnnData-usage

varp

See the varp slot in AnnData-usage

uns

See the uns slot in AnnData-usage

shape

Shape tuple (e.g. c(n_obs, n_vars)). Can be provided if both X or obs and var are not provided.


Method clone()

The objects of this class are cloneable with this method.

Usage

InMemoryAnnData$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

## complete example
ad <- AnnData(
  X = matrix(1:15, 3L, 5L),
  layers = list(
    A = matrix(5:1, 3L, 5L),
    B = matrix(letters[1:5], 3L, 5L)
  ),
  obs = data.frame(row.names = LETTERS[1:3], cell = 1:3),
  var = data.frame(row.names = letters[1:5], gene = 1:5)
)
ad
#> InMemoryAnnData object with n_obs × n_vars = 3 × 5
#>     obs: 'cell'
#>     var: 'gene'
#>     layers: 'A', 'B'

## minimum example
AnnData(
  obs = data.frame(row.names = letters[1:10]),
  var = data.frame(row.names = LETTERS[1:5])
)
#> InMemoryAnnData object with n_obs × n_vars = 10 × 5