cellarr-array 0.0.1__tar.gz → 0.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cellarr-array might be problematic. Click here for more details.

Files changed (44) hide show
  1. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/CHANGELOG.md +4 -0
  2. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/PKG-INFO +29 -10
  3. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/README.md +28 -9
  4. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/docs/conf.py +1 -1
  5. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/docs/index.md +1 -12
  6. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/src/cellarr_array/CellArray.py +10 -8
  7. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/src/cellarr_array.egg-info/PKG-INFO +29 -10
  8. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/src/cellarr_array.egg-info/SOURCES.txt +1 -0
  9. cellarr_array-0.0.2/tests/test_inmemory.py +34 -0
  10. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/.coveragerc +0 -0
  11. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/.github/workflows/publish-pypi.yml +0 -0
  12. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/.github/workflows/run-tests.yml +0 -0
  13. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/.gitignore +0 -0
  14. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/.pre-commit-config.yaml +0 -0
  15. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/.readthedocs.yml +0 -0
  16. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/AUTHORS.md +0 -0
  17. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/CONTRIBUTING.md +0 -0
  18. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/LICENSE.txt +0 -0
  19. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/docs/Makefile +0 -0
  20. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/docs/_static/.gitignore +0 -0
  21. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/docs/authors.md +0 -0
  22. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/docs/changelog.md +0 -0
  23. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/docs/contributing.md +0 -0
  24. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/docs/license.md +0 -0
  25. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/docs/readme.md +0 -0
  26. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/docs/requirements.txt +0 -0
  27. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/pyproject.toml +0 -0
  28. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/setup.cfg +0 -0
  29. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/setup.py +0 -0
  30. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/src/cellarr_array/DenseCellArray.py +0 -0
  31. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/src/cellarr_array/SparseCellArray.py +0 -0
  32. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/src/cellarr_array/__init__.py +0 -0
  33. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/src/cellarr_array/config.py +0 -0
  34. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/src/cellarr_array/helpers.py +0 -0
  35. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/src/cellarr_array.egg-info/dependency_links.txt +0 -0
  36. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/src/cellarr_array.egg-info/not-zip-safe +0 -0
  37. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/src/cellarr_array.egg-info/requires.txt +0 -0
  38. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/src/cellarr_array.egg-info/top_level.txt +0 -0
  39. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/tests/conftest.py +0 -0
  40. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/tests/test_all.py +0 -0
  41. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/tests/test_dense.py +0 -0
  42. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/tests/test_helpers.py +0 -0
  43. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/tests/test_sparse.py +0 -0
  44. {cellarr_array-0.0.1 → cellarr_array-0.0.2}/tox.ini +0 -0
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 0.0.2
4
+
5
+ - Support in-memory tiledb objects. Updated tests and documentation.
6
+
3
7
  ## Version 0.0.1
4
8
 
5
9
  Initial implementation of the sparse and dense arrays backed by TileDB.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: cellarr-array
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Base class for handling TileDB backed arrays.
5
5
  Home-page: https://github.com/cellarr/cellarr-array
6
6
  Author: Jayaram Kancherla
@@ -26,7 +26,7 @@ Requires-Dist: pytest-cov; extra == "testing"
26
26
 
27
27
  # cellarr-array
28
28
 
29
- This package provided high-level wrappers for TileDB arrays optimized for handling genomic data matrices.
29
+ This package provided high-level wrappers for TileDB arrays, for handling genomic data matrices.
30
30
 
31
31
  ## Install
32
32
 
@@ -116,24 +116,43 @@ subset = dense_array[100:200, genes]
116
116
  ### Working with Sparse Arrays
117
117
 
118
118
  ```python
119
- # Create a sparse array with COO output format
120
- coo_array = SparseCellArray(
119
+ from cellarr_array import SparseCellArray
120
+
121
+ # Create a sparse array with CSR output format
122
+ csr_array = SparseCellArray(
121
123
  uri="sparse_matrix.tdb",
122
- return_coo=True
124
+ return_sparse=True
123
125
  )
124
126
 
125
- # Get result as COO matrix
126
- result = coo_array[100:200, 500:1000]
127
+ # Get result as CSR matrix
128
+ result = csr_array[100:200, 500:1000]
127
129
 
128
130
  # Result is scipy.sparse.coo_matrix
129
- assert sparse.isspmatrix_coo(result)
131
+ assert sparse.isspmatrix_csr(result)
130
132
 
131
133
  # Perform sparse operations
132
134
  nnz = result.nnz
133
135
  density = result.nnz / (result.shape[0] * result.shape[1])
134
136
 
135
137
  # Convert to other sparse formats if needed
136
- result_csr = result.tocsr()
138
+ result_csc = result.tocsc()
139
+ ```
140
+
141
+ Likewise create a CSC output format
142
+
143
+ ```python
144
+ from scipy import sparse
145
+
146
+ # Create a sparse array with CSC output format
147
+ csc_array = SparseCellArray(
148
+ uri="sparse_matrix.tdb",
149
+ return_sparse=True,
150
+ sparse_coerce=sparse.csc_matrix
151
+ )
152
+
153
+ # Get result as CSR matrix
154
+ result = csc_array[100:200, 500:1000]
155
+ print(result)
137
156
  ```
138
157
 
139
158
  ### Array Maintenance
@@ -144,7 +163,7 @@ array.consolidate()
144
163
 
145
164
  # Custom consolidation
146
165
  config = ConsolidationConfig(
147
- steps=["fragment"],
166
+ steps=2,
148
167
  vacuum_after=True
149
168
  )
150
169
  array.consolidate(config)
@@ -3,7 +3,7 @@
3
3
 
4
4
  # cellarr-array
5
5
 
6
- This package provided high-level wrappers for TileDB arrays optimized for handling genomic data matrices.
6
+ This package provided high-level wrappers for TileDB arrays, for handling genomic data matrices.
7
7
 
8
8
  ## Install
9
9
 
@@ -93,24 +93,43 @@ subset = dense_array[100:200, genes]
93
93
  ### Working with Sparse Arrays
94
94
 
95
95
  ```python
96
- # Create a sparse array with COO output format
97
- coo_array = SparseCellArray(
96
+ from cellarr_array import SparseCellArray
97
+
98
+ # Create a sparse array with CSR output format
99
+ csr_array = SparseCellArray(
98
100
  uri="sparse_matrix.tdb",
99
- return_coo=True
101
+ return_sparse=True
100
102
  )
101
103
 
102
- # Get result as COO matrix
103
- result = coo_array[100:200, 500:1000]
104
+ # Get result as CSR matrix
105
+ result = csr_array[100:200, 500:1000]
104
106
 
105
107
  # Result is scipy.sparse.coo_matrix
106
- assert sparse.isspmatrix_coo(result)
108
+ assert sparse.isspmatrix_csr(result)
107
109
 
108
110
  # Perform sparse operations
109
111
  nnz = result.nnz
110
112
  density = result.nnz / (result.shape[0] * result.shape[1])
111
113
 
112
114
  # Convert to other sparse formats if needed
113
- result_csr = result.tocsr()
115
+ result_csc = result.tocsc()
116
+ ```
117
+
118
+ Likewise create a CSC output format
119
+
120
+ ```python
121
+ from scipy import sparse
122
+
123
+ # Create a sparse array with CSC output format
124
+ csc_array = SparseCellArray(
125
+ uri="sparse_matrix.tdb",
126
+ return_sparse=True,
127
+ sparse_coerce=sparse.csc_matrix
128
+ )
129
+
130
+ # Get result as CSR matrix
131
+ result = csc_array[100:200, 500:1000]
132
+ print(result)
114
133
  ```
115
134
 
116
135
  ### Array Maintenance
@@ -121,7 +140,7 @@ array.consolidate()
121
140
 
122
141
  # Custom consolidation
123
142
  config = ConsolidationConfig(
124
- steps=["fragment"],
143
+ steps=2,
125
144
  vacuum_after=True
126
145
  )
127
146
  array.consolidate(config)
@@ -311,7 +311,7 @@ extensions.remove('myst_parser')
311
311
  extensions.append('myst_nb')
312
312
 
313
313
  # Less verbose api documentation
314
- # extensions.append('sphinx_autodoc_typehints')
314
+ extensions.append('sphinx_autodoc_typehints')
315
315
 
316
316
  autodoc_default_options = {
317
317
  "special-members": True,
@@ -1,17 +1,6 @@
1
1
  # cellarr-array
2
2
 
3
- Add a short description here!
4
-
5
-
6
- ## Note
7
-
8
- > This is the main page of your project's [Sphinx] documentation. It is
9
- > formatted in [Markdown]. Add additional pages by creating md-files in
10
- > `docs` or rst-files (formatted in [reStructuredText]) and adding links to
11
- > them in the `Contents` section below.
12
- >
13
- > Please check [Sphinx] and [MyST] for more information
14
- > about how to document your project and how to configure your preferences.
3
+ This package provided high-level wrappers for TileDB arrays optimized for handling genomic data matrices.
15
4
 
16
5
 
17
6
  ## Contents
@@ -42,7 +42,8 @@ class CellArray(ABC):
42
42
  Defaults to None for automatic mode switching.
43
43
 
44
44
  config_or_context:
45
- Config or context object.
45
+ Optional config or context object.
46
+
46
47
  Defaults to None.
47
48
 
48
49
  validate:
@@ -53,14 +54,15 @@ class CellArray(ABC):
53
54
  self._mode = mode
54
55
 
55
56
  if config_or_context is None:
56
- config_or_context = tiledb.Config()
57
-
58
- if isinstance(config_or_context, tiledb.Config):
59
- ctx = tiledb.Ctx(config_or_context)
60
- elif isinstance(config_or_context, tiledb.Ctx):
61
- ctx = config_or_context
57
+ # config_or_context = tiledb.Config()
58
+ ctx = None
62
59
  else:
63
- raise TypeError("'config_or_context' must be either TileDB config or a context object.")
60
+ if isinstance(config_or_context, tiledb.Config):
61
+ ctx = tiledb.Ctx(config_or_context)
62
+ elif isinstance(config_or_context, tiledb.Ctx):
63
+ ctx = config_or_context
64
+ else:
65
+ raise TypeError("'config_or_context' must be either TileDB config or a context object.")
64
66
 
65
67
  self._ctx = ctx
66
68
  self._array = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: cellarr-array
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Base class for handling TileDB backed arrays.
5
5
  Home-page: https://github.com/cellarr/cellarr-array
6
6
  Author: Jayaram Kancherla
@@ -26,7 +26,7 @@ Requires-Dist: pytest-cov; extra == "testing"
26
26
 
27
27
  # cellarr-array
28
28
 
29
- This package provided high-level wrappers for TileDB arrays optimized for handling genomic data matrices.
29
+ This package provided high-level wrappers for TileDB arrays, for handling genomic data matrices.
30
30
 
31
31
  ## Install
32
32
 
@@ -116,24 +116,43 @@ subset = dense_array[100:200, genes]
116
116
  ### Working with Sparse Arrays
117
117
 
118
118
  ```python
119
- # Create a sparse array with COO output format
120
- coo_array = SparseCellArray(
119
+ from cellarr_array import SparseCellArray
120
+
121
+ # Create a sparse array with CSR output format
122
+ csr_array = SparseCellArray(
121
123
  uri="sparse_matrix.tdb",
122
- return_coo=True
124
+ return_sparse=True
123
125
  )
124
126
 
125
- # Get result as COO matrix
126
- result = coo_array[100:200, 500:1000]
127
+ # Get result as CSR matrix
128
+ result = csr_array[100:200, 500:1000]
127
129
 
128
130
  # Result is scipy.sparse.coo_matrix
129
- assert sparse.isspmatrix_coo(result)
131
+ assert sparse.isspmatrix_csr(result)
130
132
 
131
133
  # Perform sparse operations
132
134
  nnz = result.nnz
133
135
  density = result.nnz / (result.shape[0] * result.shape[1])
134
136
 
135
137
  # Convert to other sparse formats if needed
136
- result_csr = result.tocsr()
138
+ result_csc = result.tocsc()
139
+ ```
140
+
141
+ Likewise create a CSC output format
142
+
143
+ ```python
144
+ from scipy import sparse
145
+
146
+ # Create a sparse array with CSC output format
147
+ csc_array = SparseCellArray(
148
+ uri="sparse_matrix.tdb",
149
+ return_sparse=True,
150
+ sparse_coerce=sparse.csc_matrix
151
+ )
152
+
153
+ # Get result as CSR matrix
154
+ result = csc_array[100:200, 500:1000]
155
+ print(result)
137
156
  ```
138
157
 
139
158
  ### Array Maintenance
@@ -144,7 +163,7 @@ array.consolidate()
144
163
 
145
164
  # Custom consolidation
146
165
  config = ConsolidationConfig(
147
- steps=["fragment"],
166
+ steps=2,
148
167
  vacuum_after=True
149
168
  )
150
169
  array.consolidate(config)
@@ -39,4 +39,5 @@ tests/conftest.py
39
39
  tests/test_all.py
40
40
  tests/test_dense.py
41
41
  tests/test_helpers.py
42
+ tests/test_inmemory.py
42
43
  tests/test_sparse.py
@@ -0,0 +1,34 @@
1
+ from pathlib import Path
2
+
3
+ import numpy as np
4
+ import pytest
5
+ import scipy as sp
6
+
7
+ from cellarr_array import DenseCellArray, create_cellarray
8
+
9
+ __author__ = "Jayaram Kancherla"
10
+ __copyright__ = "Jayaram Kancherla"
11
+ __license__ = "MIT"
12
+
13
+
14
+ def test_inmem_uri():
15
+ shape = (10_000, 10_000)
16
+ arr = np.arange(100_000_000).reshape(shape)
17
+ uri = "mem://dense"
18
+
19
+ dense_inmem = create_cellarray(uri, shape=(shape))
20
+ dense_inmem.write_batch(arr, start_row=0)
21
+
22
+ assert np.allclose(dense_inmem[:10, :10], arr[:10, :10])
23
+
24
+
25
+ def test_inmem_uri_sparse():
26
+ shape = (1000, 1000)
27
+
28
+ s = sp.sparse.random(1000, 1000, density=0.25)
29
+ uri = "mem://sparse"
30
+
31
+ dense_inmem = create_cellarray(uri, shape=(shape), sparse=True)
32
+ dense_inmem.write_batch(s, start_row=0)
33
+
34
+ assert np.allclose(dense_inmem[:10, :10].toarray(), s.tocsr()[:10, :10].toarray())
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes