cap-anndata 0.2.0__py3-none-any.whl → 0.2.2__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
cap_anndata/backed_df.py CHANGED
@@ -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 | None = True) -> Self:
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 _write_elem_lzf(self, dest_key: str, elem: any) -> None:
95
- write_elem(self._file, dest_key, elem, dataset_kwargs={"compression": "lzf"})
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._write_elem_lzf(f"{key}/{col}", entity[col].values)
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._write_elem_lzf(dest, self.uns[key])
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
- sourse = self._file[f"uns/{key}"]
265
- self.uns[key] = read_elem(sourse)
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.0
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 >=1.26.3
16
- Requires-Dist: pandas >=2.2.0
17
- Requires-Dist: anndata >=0.10.5
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
 
@@ -0,0 +1,10 @@
1
+ cap_anndata/__init__.py,sha256=l9lvFpcMsQksp8_dI-fjUgrImoMdztbu3jVSdmxNPmA,205
2
+ cap_anndata/backed_df.py,sha256=06wZwEjszFQ8lkvy6-GgD_SD14idu9857RtlfMQiBjE,2691
3
+ cap_anndata/backed_uns.py,sha256=Tfxoz3RgcgENf4SvxFOox9w048K2QmBTh1VbAf4yqVI,854
4
+ cap_anndata/cap_anndata.py,sha256=fEaIwWIKKDJpIsQ7cwOfUTmUReIyryv5qRDqRjRsWhU,10185
5
+ cap_anndata/reader.py,sha256=kg9xoS_S0gY6WpsHE8PwGMa14VXh9Ibqjw4bwoerYsE,1267
6
+ cap_anndata-0.2.2.dist-info/LICENSE,sha256=JAV0w7TBl6wQe9iFcCKjAWgpurym0f-Q0B75zm2PrKw,1560
7
+ cap_anndata-0.2.2.dist-info/METADATA,sha256=h41dgoz3w2rDHnic828FahjEoKq1lt_Bi1jm-ZX-goA,9569
8
+ cap_anndata-0.2.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
9
+ cap_anndata-0.2.2.dist-info/top_level.txt,sha256=GKi_Uk4LUhXwWBfFCTIyJvEoJqFREt_4uH4CWgeLsg4,12
10
+ cap_anndata-0.2.2.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- cap_anndata/__init__.py,sha256=l9lvFpcMsQksp8_dI-fjUgrImoMdztbu3jVSdmxNPmA,205
2
- cap_anndata/backed_df.py,sha256=wKtQ_LkTpfPIfBod9kGlEUrmJMYe7TGs9TZexvmz7QI,2678
3
- cap_anndata/backed_uns.py,sha256=Tfxoz3RgcgENf4SvxFOox9w048K2QmBTh1VbAf4yqVI,854
4
- cap_anndata/cap_anndata.py,sha256=nv5f7A9jyK_rZ2kx54XvnX-V65MFlE3CYQC-n_zBhB8,10097
5
- cap_anndata/reader.py,sha256=kg9xoS_S0gY6WpsHE8PwGMa14VXh9Ibqjw4bwoerYsE,1267
6
- cap_anndata-0.2.0.dist-info/LICENSE,sha256=JAV0w7TBl6wQe9iFcCKjAWgpurym0f-Q0B75zm2PrKw,1560
7
- cap_anndata-0.2.0.dist-info/METADATA,sha256=xh25tmJOKCeTnWL3Cir-PXixFmZYIUcKuaUw4Uzrarg,9487
8
- cap_anndata-0.2.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
9
- cap_anndata-0.2.0.dist-info/top_level.txt,sha256=GKi_Uk4LUhXwWBfFCTIyJvEoJqFREt_4uH4CWgeLsg4,12
10
- cap_anndata-0.2.0.dist-info/RECORD,,