cap-anndata 0.2.2__tar.gz → 0.3.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- cap_anndata-0.3.0/PKG-INFO +54 -0
- cap_anndata-0.3.0/README.md +33 -0
- {cap_anndata-0.2.2 → cap_anndata-0.3.0}/cap_anndata/__init__.py +1 -1
- cap_anndata-0.3.0/cap_anndata/backed_dict.py +34 -0
- cap_anndata-0.3.0/cap_anndata/cap_anndata.py +600 -0
- cap_anndata-0.3.0/cap_anndata/reader.py +57 -0
- cap_anndata-0.3.0/cap_anndata.egg-info/PKG-INFO +54 -0
- {cap_anndata-0.2.2 → cap_anndata-0.3.0}/cap_anndata.egg-info/SOURCES.txt +2 -2
- cap_anndata-0.3.0/cap_anndata.egg-info/requires.txt +7 -0
- {cap_anndata-0.2.2 → cap_anndata-0.3.0}/setup.py +4 -5
- cap_anndata-0.3.0/test/test_backed_df.py +81 -0
- cap_anndata-0.3.0/test/test_backed_dict.py +36 -0
- {cap_anndata-0.2.2 → cap_anndata-0.3.0}/test/test_cap_anndata.py +269 -11
- cap_anndata-0.3.0/test/test_reader.py +63 -0
- cap_anndata-0.2.2/PKG-INFO +0 -253
- cap_anndata-0.2.2/README.md +0 -231
- cap_anndata-0.2.2/cap_anndata/backed_uns.py +0 -28
- cap_anndata-0.2.2/cap_anndata/cap_anndata.py +0 -287
- cap_anndata-0.2.2/cap_anndata/reader.py +0 -44
- cap_anndata-0.2.2/cap_anndata.egg-info/PKG-INFO +0 -253
- cap_anndata-0.2.2/cap_anndata.egg-info/requires.txt +0 -8
- cap_anndata-0.2.2/test/test_backed_df.py +0 -81
- cap_anndata-0.2.2/test/test_backed_uns.py +0 -36
- cap_anndata-0.2.2/test/test_reader.py +0 -22
- {cap_anndata-0.2.2 → cap_anndata-0.3.0}/LICENSE +0 -0
- {cap_anndata-0.2.2 → cap_anndata-0.3.0}/cap_anndata/backed_df.py +0 -0
- {cap_anndata-0.2.2 → cap_anndata-0.3.0}/cap_anndata.egg-info/dependency_links.txt +0 -0
- {cap_anndata-0.2.2 → cap_anndata-0.3.0}/cap_anndata.egg-info/top_level.txt +0 -0
- {cap_anndata-0.2.2 → cap_anndata-0.3.0}/setup.cfg +0 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: cap_anndata
|
3
|
+
Version: 0.3.0
|
4
|
+
Summary: Partial read/write of AnnData (h5ad) files for low-memory operations with large datasets.
|
5
|
+
Home-page: https://github.com/cellannotation/cap-anndata
|
6
|
+
Author: R. Mukhin, A. Isaev
|
7
|
+
Author-email: roman@ebookapplications.com
|
8
|
+
Project-URL: Bug Tracker, https://github.com/cellannotation/cap-anndata/issues
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
10
|
+
Classifier: License :: OSI Approved :: BSD License
|
11
|
+
Classifier: Operating System :: OS Independent
|
12
|
+
Requires-Python: >=3.9
|
13
|
+
Description-Content-Type: text/markdown
|
14
|
+
License-File: LICENSE
|
15
|
+
Requires-Dist: numpy>=1.23.5
|
16
|
+
Requires-Dist: pandas>=2.2.0
|
17
|
+
Requires-Dist: anndata>=0.10.0
|
18
|
+
Provides-Extra: dev
|
19
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
20
|
+
Requires-Dist: setuptools~=69.1.1; extra == "dev"
|
21
|
+
|
22
|
+
# CAP-AnnData: Partial I/O for AnnData (.h5ad) Files
|
23
|
+
|
24
|
+
## Overview
|
25
|
+
CAP-AnnData offering functionalities for selective reading and writing of [AnnData](https://pypi.org/project/anndata/)
|
26
|
+
file fields without the need for loading entire dataset (or even entire field) into memory.
|
27
|
+
For example, it allows to read and modify the single `obs` column taking nothing into memory except the column itself.
|
28
|
+
Package eager to replicate the original AnnData API as much as possible,
|
29
|
+
while providing additional features for efficient data manipulation for heavy datasets.
|
30
|
+
|
31
|
+
## Installation
|
32
|
+
Install CAP-AnnData via pip:
|
33
|
+
|
34
|
+
```commandline
|
35
|
+
pip install -U cap-anndata
|
36
|
+
```
|
37
|
+
|
38
|
+
## Basic Example
|
39
|
+
|
40
|
+
The example below displayes how to read a single `obs` column, create new obs column and propagate it to the `.h5ad` file.
|
41
|
+
```python
|
42
|
+
from cap_anndata import read_h5ad
|
43
|
+
|
44
|
+
file_path = "your_data.h5ad"
|
45
|
+
with read_h5ad(file_path=file_path, edit=True) as cap_adata:
|
46
|
+
print(cap_adata.obs_keys()) # ['a', 'b', 'c']
|
47
|
+
print(cap_adata.obs) # Empty DataFrame
|
48
|
+
cap_adata.read_obs(columns=['a'])
|
49
|
+
print(cap_adata.obs.columns) # ['a']
|
50
|
+
cap_adata.obs['new_col'] = cap_adata.obs['a']
|
51
|
+
cap_adata.overwrite(fields=['obs'])
|
52
|
+
```
|
53
|
+
|
54
|
+
More example can be found in the [How-TO](https://github.com/cellannotation/cap-anndata/blob/main/HOWTO.md) file.
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# CAP-AnnData: Partial I/O for AnnData (.h5ad) Files
|
2
|
+
|
3
|
+
## Overview
|
4
|
+
CAP-AnnData offering functionalities for selective reading and writing of [AnnData](https://pypi.org/project/anndata/)
|
5
|
+
file fields without the need for loading entire dataset (or even entire field) into memory.
|
6
|
+
For example, it allows to read and modify the single `obs` column taking nothing into memory except the column itself.
|
7
|
+
Package eager to replicate the original AnnData API as much as possible,
|
8
|
+
while providing additional features for efficient data manipulation for heavy datasets.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
Install CAP-AnnData via pip:
|
12
|
+
|
13
|
+
```commandline
|
14
|
+
pip install -U cap-anndata
|
15
|
+
```
|
16
|
+
|
17
|
+
## Basic Example
|
18
|
+
|
19
|
+
The example below displayes how to read a single `obs` column, create new obs column and propagate it to the `.h5ad` file.
|
20
|
+
```python
|
21
|
+
from cap_anndata import read_h5ad
|
22
|
+
|
23
|
+
file_path = "your_data.h5ad"
|
24
|
+
with read_h5ad(file_path=file_path, edit=True) as cap_adata:
|
25
|
+
print(cap_adata.obs_keys()) # ['a', 'b', 'c']
|
26
|
+
print(cap_adata.obs) # Empty DataFrame
|
27
|
+
cap_adata.read_obs(columns=['a'])
|
28
|
+
print(cap_adata.obs.columns) # ['a']
|
29
|
+
cap_adata.obs['new_col'] = cap_adata.obs['a']
|
30
|
+
cap_adata.overwrite(fields=['obs'])
|
31
|
+
```
|
32
|
+
|
33
|
+
More example can be found in the [How-TO](https://github.com/cellannotation/cap-anndata/blob/main/HOWTO.md) file.
|
@@ -0,0 +1,34 @@
|
|
1
|
+
from typing import Set, Any
|
2
|
+
|
3
|
+
|
4
|
+
class CapAnnDataDict(dict):
|
5
|
+
__keys_to_remove: Set[str] = None
|
6
|
+
|
7
|
+
def __delitem__(self, __key: Any) -> None:
|
8
|
+
self.keys_to_remove.add(__key)
|
9
|
+
return super().__delitem__(__key)
|
10
|
+
|
11
|
+
def __setitem__(self, __key: Any, __value: Any) -> None:
|
12
|
+
if __value is not None:
|
13
|
+
if __key in self.keys_to_remove:
|
14
|
+
self.keys_to_remove.remove(__key)
|
15
|
+
else:
|
16
|
+
self.keys_to_remove.add(__key)
|
17
|
+
return super().__setitem__(__key, __value)
|
18
|
+
|
19
|
+
@property
|
20
|
+
def keys_to_remove(self) -> Set[str]:
|
21
|
+
if self.__keys_to_remove is None:
|
22
|
+
self.__keys_to_remove = set()
|
23
|
+
return self.__keys_to_remove
|
24
|
+
|
25
|
+
def pop(self, __key: Any, __default: Any = None) -> Any:
|
26
|
+
if __key in self:
|
27
|
+
self.keys_to_remove.add(__key)
|
28
|
+
return super().pop(__key, __default)
|
29
|
+
|
30
|
+
def popitem(self) -> Any:
|
31
|
+
item = super().popitem()
|
32
|
+
key = item[0]
|
33
|
+
self.keys_to_remove.add(key)
|
34
|
+
return item
|