bioalpha.h5ad_map.H5ADMap

class bioalpha.h5ad_map.H5ADMap(filename: Path, filemode: str = 'r+', raw_file: H5ADMapFile | None = None, is_raw_file: bool = True)

An AnnData mapped to a HDF5 file with limited operations.

Slicing, transpose, deletion on H5ADMap along any axis is not permitted.

Attibutes operations:

X, layers:

SparseDataset and h5py.Dataset updates are supported. Deletion and re-assignment are not supported.

obs, var, uns:

The attributes are loaded into memory. To commit changes to h5ad file, call flush().

obsm, obsp, varm, varp:

Read, write, update, deletion are fully supported.

raw: X, var, varm:

Same as H5ADMap.

Methods

chunk_X([select, replace])

Return a chunk of the data matrix X with random or specified indices.

chunked_X([axis, shuffle, chunk_size, ...])

Return an iterator over the rows of the data matrix X.

concatenate(*args, **kwargs)

Concatenate along the observations axis.

copy(filename)

Full copy, optionally on disk.

diet_subset(subset_path[, X, keys, ...])

Subset an anndata with list of keys request.

flush(*args, **kwargs)

free_temp_processing()

obs_keys()

List keys of observation annotation obs.

obs_names_make_unique([join])

Makes the index unique by appending a number string to each duplicate index element: '1', '2', etc.

obs_vector(k, *[, layer])

Convenience function for returning a 1 dimensional ndarray of values from X, layers[k], or obs.

obsm_keys()

List keys of observation annotation obsm.

rename_categories(key, categories)

Rename categories of annotation key in obs, var, and uns.

set_backed(group, key, value, *args, **kwargs)

strings_to_categoricals([df])

Transform string annotations to categoricals.

to_df([layer])

Generate shallow DataFrame.

to_memory()

Return a new AnnData object with all backed arrays loaded into memory.

transpose()

Transpose whole object.

uns_keys()

List keys of unstructured annotation.

var_keys()

List keys of variable annotation var.

var_names_make_unique([join])

Makes the index unique by appending a number string to each duplicate index element: '1', '2', etc.

var_vector(k, *[, layer])

Convenience function for returning a 1 dimensional ndarray of values from X, layers[k], or obs.

varm_keys()

List keys of variable annotation varm.

write([filename, compression, ...])

Write .h5ad-formatted hdf5 file.

write_csvs(*args, **kwargs)

Write annotation to .csv files.

write_h5ad(filename)

Write .h5ad-formatted hdf5 file.

write_loom(*args, **kwargs)

Write .loom-formatted hdf5 file.

write_zarr(*args, **kwargs)

Write a hierarchical Zarr array store.

Attributes

T

Transpose whole object.

X

Data matrix of shape n_obs × n_vars.

file

filemode

filename

Change to backing mode by setting the filename of a .h5ad file.

is_view

H5ADMap is not supported view

isbacked

True if object is backed on disk, False otherwise.

layers

Dictionary-like object with values of the same dimensions as X.

n_obs

Number of observations.

n_vars

Number of variables/features.

obs

One-dimensional annotation of observations (pd.DataFrame).

obs_names

Names of observations (alias for .obs.index).

obsm

Multi-dimensional annotation of observations (mutable structured ndarray).

obsp

Pairwise annotation of observations, a mutable mapping with array-like values.

raw

Store raw version of X and var as .raw.X and .raw.var.

shape

Shape of data matrix (n_obs, n_vars).

uns

Unstructured annotation (ordered dictionary).

var

One-dimensional annotation of variables/ features (pd.DataFrame).

var_names

Names of variables (alias for .var.index).

varm

Multi-dimensional annotation of variables/features (mutable structured ndarray).

varp

Pairwise annotation of variables/features, a mutable mapping with array-like values.