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)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], orobs
.List keys of observation annotation
obsm
.rename_categories
(key, categories)set_backed
(group, key, value, *args, **kwargs)strings_to_categoricals
([df])Transform string annotations to categoricals.
to_df
([layer])Generate shallow
DataFrame
.Return a new AnnData object with all backed arrays loaded into memory.
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], orobs
.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
Transpose whole object.
Change to backing mode by setting the filename of a .h5ad file.
H5ADMap is not supported view
True if object is backed on disk, False otherwise.
Dictionary-like object with values of the same dimensions as
X
.Number of observations.
Number of variables/features.
One-dimensional annotation of observations (pd.DataFrame).
Names of observations (alias for .obs.index).
Multi-dimensional annotation of observations (mutable structured
ndarray
).Pairwise annotation of observations, a mutable mapping with array-like values.
Unstructured annotation (ordered dictionary).
One-dimensional annotation of variables/ features (pd.DataFrame).
Names of variables (alias for .var.index).
Multi-dimensional annotation of variables/features (mutable structured
ndarray
).Pairwise annotation of variables/features, a mutable mapping with array-like values.