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
File details
Details for the file cap_anndata-0.3.1.tar.gz
.
File metadata
- Download URL: cap_anndata-0.3.1.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92f14e5d1eb80ca8a7ab30f91cad2c8309f0d67d306e48d8221c298027ea7056 |
|
MD5 | 5e514d58f67c7eaea1a26e9bc606ef52 |
|
BLAKE2b-256 | a070f6fa928bcd6b453ba8a4d0a4287f3b7f198784236028beb6d6e2c4355eab |
File details
Details for the file cap_anndata-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: cap_anndata-0.3.1-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1f83bba36eff7a853aa3a94d2876c9157c6c1eb4b23b7884686cb89f80baa62 |
|
MD5 | 8fd8b71122188404763e2871dd8b3b33 |
|
BLAKE2b-256 | 63dfb655a3189f28ad6519303d1a0fee9660989b4fe7d713ed2be1d5ff076a4d |