Read-only AnnData-shaped facade over a Daf.
Read-only AnnData-shaped facade over a Daf.
Details
Exposes a DafReader through the property names familiar to
anndata / scanpy / Seurat users: X, obs, var, layers,
uns, obs_names, var_names, n_obs, n_vars, shape. All
bindings are read-only; modifying data requires writing to the
underlying Daf directly.
Public fields
dafThe underlying Daf object.
obs_axisName of the observations axis.
var_axisName of the variables axis.
x_nameMatrix name for
X.
Active bindings
XThe primary matrix (
obs_axisxvar_axis).obsData frame of observation vectors.
varData frame of variable vectors.
obs_namesCharacter vector of observation names.
var_namesCharacter vector of variable names.
n_obsNumber of observations.
n_varsNumber of variables.
shapeDimensions
c(n_obs, n_vars).layersNamed list of additional matrices (excluding
X).unsNamed list of scalars.
Methods
Method new()
Create a DafAnnData facade.
Usage
DafAnnData$new(daf, obs_axis = NULL, var_axis = NULL, x_name = "UMIs")Arguments
dafA DafReader.
obs_axisAxis name for observations. Defaults auto-detect:
"cell"then"metacell".var_axisAxis name for variables. Defaults to
"gene".x_nameMatrix name for
X. Default"UMIs".
Examples
d <- memory_daf()
add_axis(d, "cell", c("c1", "c2"))
add_axis(d, "gene", c("g1", "g2", "g3"))
set_matrix(d, "cell", "gene", "UMIs", matrix(1:6, 2, 3))
ann <- as_anndata(d)
ann$X
#> g1 g2 g3
#> c1 1 3 5
#> c2 2 4 6
ann$obs_names
#> [1] "c1" "c2"