cap-anndata 0.2.0__tar.gz → 0.2.2__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {cap_anndata-0.2.0 → cap_anndata-0.2.2}/PKG-INFO +6 -4
- {cap_anndata-0.2.0 → cap_anndata-0.2.2}/cap_anndata/backed_df.py +2 -2
- {cap_anndata-0.2.0 → cap_anndata-0.2.2}/cap_anndata/cap_anndata.py +7 -7
- {cap_anndata-0.2.0 → cap_anndata-0.2.2}/cap_anndata.egg-info/PKG-INFO +6 -4
- cap_anndata-0.2.2/cap_anndata.egg-info/requires.txt +8 -0
- {cap_anndata-0.2.0 → cap_anndata-0.2.2}/setup.py +9 -5
- {cap_anndata-0.2.0 → cap_anndata-0.2.2}/test/test_cap_anndata.py +6 -4
- cap_anndata-0.2.0/cap_anndata.egg-info/requires.txt +0 -6
- {cap_anndata-0.2.0 → cap_anndata-0.2.2}/LICENSE +0 -0
- {cap_anndata-0.2.0 → cap_anndata-0.2.2}/README.md +0 -0
- {cap_anndata-0.2.0 → cap_anndata-0.2.2}/cap_anndata/__init__.py +0 -0
- {cap_anndata-0.2.0 → cap_anndata-0.2.2}/cap_anndata/backed_uns.py +0 -0
- {cap_anndata-0.2.0 → cap_anndata-0.2.2}/cap_anndata/reader.py +0 -0
- {cap_anndata-0.2.0 → cap_anndata-0.2.2}/cap_anndata.egg-info/SOURCES.txt +0 -0
- {cap_anndata-0.2.0 → cap_anndata-0.2.2}/cap_anndata.egg-info/dependency_links.txt +0 -0
- {cap_anndata-0.2.0 → cap_anndata-0.2.2}/cap_anndata.egg-info/top_level.txt +0 -0
- {cap_anndata-0.2.0 → cap_anndata-0.2.2}/setup.cfg +0 -0
- {cap_anndata-0.2.0 → cap_anndata-0.2.2}/test/test_backed_df.py +0 -0
- {cap_anndata-0.2.0 → cap_anndata-0.2.2}/test/test_backed_uns.py +0 -0
- {cap_anndata-0.2.0 → cap_anndata-0.2.2}/test/test_reader.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: cap_anndata
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.2
|
4
4
|
Summary: Partial read/write of AnnData (h5ad) files for low-memory operations with large datasets.
|
5
5
|
Home-page: https://github.com/cellannotation/cap-anndata
|
6
6
|
Author: R. Mukhin, A. Isaev
|
@@ -12,11 +12,13 @@ Classifier: Operating System :: OS Independent
|
|
12
12
|
Requires-Python: >=3.9
|
13
13
|
Description-Content-Type: text/markdown
|
14
14
|
License-File: LICENSE
|
15
|
-
Requires-Dist: numpy
|
16
|
-
Requires-Dist: pandas
|
17
|
-
Requires-Dist: anndata
|
15
|
+
Requires-Dist: numpy~=1.26.3
|
16
|
+
Requires-Dist: pandas~=2.2.0
|
17
|
+
Requires-Dist: anndata~=0.10.5
|
18
|
+
Requires-Dist: h5py~=3.5.0
|
18
19
|
Provides-Extra: dev
|
19
20
|
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
21
|
+
Requires-Dist: setuptools~=69.1.1; extra == "dev"
|
20
22
|
|
21
23
|
# CAP-AnnData: Enhanced Partial I/O for AnnData Files
|
22
24
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import pandas as pd
|
2
2
|
import numpy as np
|
3
|
-
from typing import List, Any
|
3
|
+
from typing import List, Any, Union
|
4
4
|
import logging
|
5
5
|
|
6
6
|
from pandas._typing import Self
|
@@ -65,5 +65,5 @@ class CapAnnDataDF(pd.DataFrame):
|
|
65
65
|
column_order = np.append(self.column_order, new_columns)
|
66
66
|
return self.from_df(result, column_order=column_order)
|
67
67
|
|
68
|
-
def copy(self, deep: bool_t
|
68
|
+
def copy(self, deep: Union[bool_t, None] = True) -> Self:
|
69
69
|
return self.from_df(super().copy(deep=deep), column_order=self.column_order)
|
@@ -91,8 +91,8 @@ class BaseLayerMatrixAndDf:
|
|
91
91
|
df.column_order = df.column_order.astype(object)
|
92
92
|
return df
|
93
93
|
|
94
|
-
def
|
95
|
-
write_elem(self._file, dest_key, elem, dataset_kwargs={"compression":
|
94
|
+
def _write_elem(self, dest_key: str, elem: any, compression: str) -> None:
|
95
|
+
write_elem(self._file, dest_key, elem, dataset_kwargs={"compression": compression})
|
96
96
|
|
97
97
|
def _validate_cap_df(self, cap_df: CapAnnDataDF, axis: int) -> None:
|
98
98
|
if not isinstance(cap_df, CapAnnDataDF):
|
@@ -210,7 +210,7 @@ class CapAnnData(BaseLayerMatrixAndDf):
|
|
210
210
|
for col in df.columns:
|
211
211
|
self._var[col] = df[col]
|
212
212
|
|
213
|
-
def overwrite(self, fields: List[str] = None) -> None:
|
213
|
+
def overwrite(self, fields: List[str] = None, compression: str = "lzf") -> None:
|
214
214
|
field_to_entity = {
|
215
215
|
"obs": self.obs,
|
216
216
|
"var": self.var,
|
@@ -237,7 +237,7 @@ class CapAnnData(BaseLayerMatrixAndDf):
|
|
237
237
|
key = key.replace(".", "/") if key == "raw.var" else key
|
238
238
|
|
239
239
|
for col in entity.columns:
|
240
|
-
self.
|
240
|
+
self._write_elem(f"{key}/{col}", entity[col].values, compression=compression)
|
241
241
|
|
242
242
|
column_order = entity.column_order
|
243
243
|
if (
|
@@ -250,7 +250,7 @@ class CapAnnData(BaseLayerMatrixAndDf):
|
|
250
250
|
for key in self.uns.keys():
|
251
251
|
if self.uns[key] is not NotLinkedObject:
|
252
252
|
dest = f"uns/{key}"
|
253
|
-
self.
|
253
|
+
self._write_elem(dest, self.uns[key], compression=compression)
|
254
254
|
for key in self.uns.keys_to_remove:
|
255
255
|
del self._file[f"uns/{key}"]
|
256
256
|
|
@@ -261,8 +261,8 @@ class CapAnnData(BaseLayerMatrixAndDf):
|
|
261
261
|
for key in keys:
|
262
262
|
existing_keys = self.uns.keys()
|
263
263
|
if key in existing_keys:
|
264
|
-
|
265
|
-
self.uns[key] = read_elem(
|
264
|
+
source = self._file[f"uns/{key}"]
|
265
|
+
self.uns[key] = read_elem(source)
|
266
266
|
|
267
267
|
def _link_obsm(self) -> None:
|
268
268
|
self._obsm = {}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: cap_anndata
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.2
|
4
4
|
Summary: Partial read/write of AnnData (h5ad) files for low-memory operations with large datasets.
|
5
5
|
Home-page: https://github.com/cellannotation/cap-anndata
|
6
6
|
Author: R. Mukhin, A. Isaev
|
@@ -12,11 +12,13 @@ Classifier: Operating System :: OS Independent
|
|
12
12
|
Requires-Python: >=3.9
|
13
13
|
Description-Content-Type: text/markdown
|
14
14
|
License-File: LICENSE
|
15
|
-
Requires-Dist: numpy
|
16
|
-
Requires-Dist: pandas
|
17
|
-
Requires-Dist: anndata
|
15
|
+
Requires-Dist: numpy~=1.26.3
|
16
|
+
Requires-Dist: pandas~=2.2.0
|
17
|
+
Requires-Dist: anndata~=0.10.5
|
18
|
+
Requires-Dist: h5py~=3.5.0
|
18
19
|
Provides-Extra: dev
|
19
20
|
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
21
|
+
Requires-Dist: setuptools~=69.1.1; extra == "dev"
|
20
22
|
|
21
23
|
# CAP-AnnData: Enhanced Partial I/O for AnnData Files
|
22
24
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
2
2
|
|
3
3
|
setup(
|
4
4
|
name='cap_anndata',
|
5
|
-
version='0.2.
|
5
|
+
version='0.2.2',
|
6
6
|
author='R. Mukhin, A. Isaev',
|
7
7
|
author_email='roman@ebookapplications.com',
|
8
8
|
packages=find_packages(exclude=["test"]),
|
@@ -20,9 +20,13 @@ setup(
|
|
20
20
|
],
|
21
21
|
python_requires='>=3.9',
|
22
22
|
install_requires=[
|
23
|
-
"numpy
|
24
|
-
"pandas
|
25
|
-
"anndata
|
23
|
+
"numpy~=1.26.3",
|
24
|
+
"pandas~=2.2.0",
|
25
|
+
"anndata~=0.10.5",
|
26
|
+
"h5py~=3.5.0",
|
26
27
|
],
|
27
|
-
extras_require={"dev": [
|
28
|
+
extras_require={"dev": [
|
29
|
+
"pytest>=8.0.0",
|
30
|
+
"setuptools~=69.1.1"
|
31
|
+
]}
|
28
32
|
)
|
@@ -102,7 +102,8 @@ def test_partial_read():
|
|
102
102
|
pd.testing.assert_index_equal(adata.raw.var.index, cap_adata.raw.var.index)
|
103
103
|
|
104
104
|
|
105
|
-
|
105
|
+
@pytest.mark.parametrize("compression", ["gzip", "lzf"])
|
106
|
+
def test_overwrite_df(compression):
|
106
107
|
adata = get_filled_anndata()
|
107
108
|
temp_folder = tempfile.mkdtemp()
|
108
109
|
file_path = os.path.join(temp_folder, "test_overwrite_df.h5ad")
|
@@ -132,7 +133,7 @@ def test_overwrite_df():
|
|
132
133
|
cap_adata.raw.var["extra_info"] = np.random.rand(cap_adata.shape[1])
|
133
134
|
ref_raw_var = cap_adata.raw.var.copy()
|
134
135
|
|
135
|
-
cap_adata.overwrite(["obs", "var", "raw.var"])
|
136
|
+
cap_adata.overwrite(["obs", "var", "raw.var"], compression=compression)
|
136
137
|
|
137
138
|
adata = ad.read_h5ad(file_path)
|
138
139
|
os.remove(file_path)
|
@@ -253,7 +254,8 @@ def test_read_uns():
|
|
253
254
|
os.remove(file_path)
|
254
255
|
|
255
256
|
|
256
|
-
|
257
|
+
@pytest.mark.parametrize("compression", ["gzip", "lzf"])
|
258
|
+
def test_modify_uns(compression):
|
257
259
|
adata = get_base_anndata()
|
258
260
|
adata.uns = {
|
259
261
|
"field_to_ignore": list(range(100)),
|
@@ -278,7 +280,7 @@ def test_modify_uns():
|
|
278
280
|
cap_adata.uns["field_to_expand"]["key1"] = d_to_exp
|
279
281
|
cap_adata.uns["field_to_modify"] = v_to_mod
|
280
282
|
|
281
|
-
cap_adata.overwrite(["uns"])
|
283
|
+
cap_adata.overwrite(["uns"], compression=compression)
|
282
284
|
|
283
285
|
adata = ad.read_h5ad(file_path)
|
284
286
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|