snapatac2.AnnData#
- class snapatac2.AnnData(*, filename, X=None, obs=None, var=None, obsm=None, varm=None, uns=None, backend=None)#
An annotated data matrix.
AnnData
stores a data matrixX
together with annotations of observationsobs
(obsm
,obsp
), variablesvar
(varm
,varp
), and unstructured annotationsuns
.AnnData
is stored as a HDF5 file. Opening/creating an AnnData object does not read data from the HDF5 file. Data is copied to memory only when individual element is requested (or when cache is turned on).- Parameters:
X – A #observations × #variables data matrix. A view of the data is used if the data type matches, otherwise, a copy is made.
obs – Key-indexed one-dimensional observations annotation of length #observations.
var – Key-indexed one-dimensional variables annotation of length #variables.
uns – Key-indexed unstructured annotation.
obsm – Key-indexed multi-dimensional observations annotation of length #observations. If passing a
ndarray
, it needs to have a structured datatype.varm – Key-indexed multi-dimensional variables annotation of length #variables. If passing a
ndarray
, it needs to have a structured datatype.filename – Name of backing file.
Note
This is a backed AnnData. You can use
to_memory
to convert it to an in-memory AnnData object. See here for the documentation of in-memory AnnData objects.Attributes
Data matrix of shape n_obs × n_vars.
Filename of the backing .h5ad file.
Whether the AnnData object is backed.
Number of observations.
Number of variables/features.
Observation annotations.
Names of observations.
Shape of data matrix (
n_obs
,n_vars
).Unstructured annotation (ordered dictionary).
Variable annotations.
Names of variables.
Methods
chunked_X
([chunk_size])Return an iterator over the rows of the data matrix X.
close
()Close the AnnData object.
copy
(filename, backend)Copy the AnnData object.
If the AnnData object has been closed.
obs_ix
(names)open
([mode])Reopen a closed AnnData object.
subset
([obs_indices, var_indices, out, ...])Subsetting the AnnData object.
Return a new AnnData object with all backed arrays loaded into memory.
var_ix
(names)write
(filename, backend)Write .h5ad-formatted hdf5 file.