snapatac2.AnnDataSet#

class snapatac2.AnnDataSet(adatas, *, filename, add_key='sample', use_absolute_path=False, backend=None)#

Similar to AnnData, AnnDataSet contains annotations of observations obs (obsm, obsp), variables var (varm, varp), and unstructured annotations uns. Additionally it provides lazy access to concatenated component AnnData objects, including X, obs, obsm, obsp.

Parameters:
  • adatas (list[(str, Path)] | list[(str, AnnData)]) – List of key and file name (or backed AnnData object) pairs.

  • filename (Path) – File name of the output file containing the AnnDataSet object.

  • add_key (str) – The column name in obs to store the keys

  • use_abolute_path (bool) – Whether to store absolute paths of the component anndata files.

  • backend (Literal['hdf5', 'zarr']) – The backend to use for the AnnDataSet object.

Note

  • AnnDataSet does not copy underlying AnnData objects. It stores the references

to individual anndata files. If you move the anndata files to a new location, remember to update the anndata file locations when opening an AnnDataSet object. - AnnDataSet requires all component anndata files to have the same set of var names. To concatenate AnnData objects with different var names, please use concat function.

See also

read_dataset, concat

Attributes

X

Data matrix of shape n_obs × n_vars.

adatas

View into the component AnnData objects.

backend

isbacked

Whether the AnnDataSet object is backed.

n_obs

Number of observations.

n_vars

Number of variables/features.

obs

Observation annotations.

obs_names

Names of observations.

obsm

obsp

shape

Shape of data matrix (n_obs, n_vars).

uns

Unstructured annotation (ordered dictionary).

var

Variable annotations.

var_names

Names of variables.

varm

varp

Methods

chunked_X([chunk_size])

close()

Close the AnnDataSet object.

is_closed()

If the AnnDataSet object has been closed.

obs_ix(names)

split_obs_by(key[, out_dir])

Split the AnnDataSet object into multiple AnnData objects based on grouping keys.

to_adata([obs_indices, var_indices, copy_x, ...])

Convert AnnDataSet to AnnData object.

var_ix(names)