cellarr-array 0.0.1__py3-none-any.whl → 0.0.2__py3-none-any.whl
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.
- cellarr_array/CellArray.py +10 -8
- {cellarr_array-0.0.1.dist-info → cellarr_array-0.0.2.dist-info}/METADATA +29 -10
- {cellarr_array-0.0.1.dist-info → cellarr_array-0.0.2.dist-info}/RECORD +6 -6
- {cellarr_array-0.0.1.dist-info → cellarr_array-0.0.2.dist-info}/LICENSE.txt +0 -0
- {cellarr_array-0.0.1.dist-info → cellarr_array-0.0.2.dist-info}/WHEEL +0 -0
- {cellarr_array-0.0.1.dist-info → cellarr_array-0.0.2.dist-info}/top_level.txt +0 -0
cellarr_array/CellArray.py
CHANGED
|
@@ -42,7 +42,8 @@ class CellArray(ABC):
|
|
|
42
42
|
Defaults to None for automatic mode switching.
|
|
43
43
|
|
|
44
44
|
config_or_context:
|
|
45
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
|
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
|
-
|
|
120
|
-
|
|
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
|
-
|
|
124
|
+
return_sparse=True
|
|
123
125
|
)
|
|
124
126
|
|
|
125
|
-
# Get result as
|
|
126
|
-
result =
|
|
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.
|
|
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
|
-
|
|
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=
|
|
166
|
+
steps=2,
|
|
148
167
|
vacuum_after=True
|
|
149
168
|
)
|
|
150
169
|
array.consolidate(config)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
cellarr_array/CellArray.py,sha256=
|
|
1
|
+
cellarr_array/CellArray.py,sha256=sFD258mPp4w-8-xmjAgoicKo0Nbu0GGa-1gMXxt5cZ0,7570
|
|
2
2
|
cellarr_array/DenseCellArray.py,sha256=iPrjFtGolnHB0BTi4A8ncEpoFI9FWe6oZHhA1Men3Wo,3745
|
|
3
3
|
cellarr_array/SparseCellArray.py,sha256=8bajVOvUMaQhWU-_pZY0Cg9sD6kWRAJCu2G45uY-W4Q,7096
|
|
4
4
|
cellarr_array/__init__.py,sha256=8m0_shRPKNNaNab5tGBL2l0K5XgkKCFuLAh7QGogfYo,778
|
|
5
5
|
cellarr_array/config.py,sha256=67zBxpYY9N_v6TMdyljUIZmckbwOBcuLC99aJooGmfA,2917
|
|
6
6
|
cellarr_array/helpers.py,sha256=O0RgDLIdYbWc01yp2Cw0EmjJ3g_uzlz2JnYE8W7PZEE,6182
|
|
7
|
-
cellarr_array-0.0.
|
|
8
|
-
cellarr_array-0.0.
|
|
9
|
-
cellarr_array-0.0.
|
|
10
|
-
cellarr_array-0.0.
|
|
11
|
-
cellarr_array-0.0.
|
|
7
|
+
cellarr_array-0.0.2.dist-info/LICENSE.txt,sha256=qI2hRZobcUlj8gqFqXwqt522HeYyWvHLF00zCSZofHA,1084
|
|
8
|
+
cellarr_array-0.0.2.dist-info/METADATA,sha256=-VmLQZQmbUhNkD_Y9ZLeZkBgLf4H5YIXgO_rDj7zKmw,4098
|
|
9
|
+
cellarr_array-0.0.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
10
|
+
cellarr_array-0.0.2.dist-info/top_level.txt,sha256=oErp0D8ABZV-QPtTiXT8_F2z36Ic7ykuDg_1Y84HLZM,14
|
|
11
|
+
cellarr_array-0.0.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|