Partial read/write of AnnData (h5ad) files for low-memory operations with large datasets.
Project description
CAP-AnnData: Partial I/O for AnnData (.h5ad) Files
Overview
CAP-AnnData offering functionalities for selective reading and writing of AnnData
file fields without the need for loading entire dataset (or even entire field) into memory.
For example, it allows to read and modify the single obs
column taking nothing into memory except the column itself.
Package eager to replicate the original AnnData API as much as possible,
while providing additional features for efficient data manipulation for heavy datasets.
Installation
Install CAP-AnnData via pip:
pip install -U cap-anndata
Basic Example
The example below displayes how to read a single obs
column, create new obs column and propagate it to the .h5ad
file.
from cap_anndata import read_h5ad
file_path = "your_data.h5ad"
with read_h5ad(file_path=file_path, edit=True) as cap_adata:
print(cap_adata.obs_keys()) # ['a', 'b', 'c']
print(cap_adata.obs) # Empty DataFrame
cap_adata.read_obs(columns=['a'])
print(cap_adata.obs.columns) # ['a']
cap_adata.obs['new_col'] = cap_adata.obs['a']
cap_adata.overwrite(fields=['obs'])
More example can be found in the How-TO file.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cap_anndata-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6983b64465f73f1d2bde1b7e360464cd6432a7d7f3467f3dd1d61d52bb2da2c5 |
|
MD5 | 871a1811abb3a7bb76c1d9cf948cb1ee |
|
BLAKE2b-256 | 0684d71fa286a544a0fe23aa33850957479abaaf533428e1a578e4a7b659e255 |