brisc 0.2.4__tar.gz → 0.2.6__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.
- {brisc-0.2.4 → brisc-0.2.6}/PKG-INFO +3 -3
- {brisc-0.2.4 → brisc-0.2.6}/README.md +2 -2
- {brisc-0.2.4 → brisc-0.2.6}/brisc/cysparse.pyx +42 -40
- {brisc-0.2.4 → brisc-0.2.6}/brisc/cyutils.pxd +281 -168
- {brisc-0.2.4 → brisc-0.2.6}/brisc/cyutils.pyx +30 -8
- {brisc-0.2.4 → brisc-0.2.6}/brisc/doublets.pyx +4 -4
- {brisc-0.2.4 → brisc-0.2.6}/brisc/embed.pyx +252 -122
- {brisc-0.2.4 → brisc-0.2.6}/brisc/harmonize.pyx +21 -13
- {brisc-0.2.4 → brisc-0.2.6}/brisc/hvg.pyx +16 -17
- {brisc-0.2.4 → brisc-0.2.6}/brisc/kmeans.pyx +26 -15
- {brisc-0.2.4 → brisc-0.2.6}/brisc/knn.pyx +44 -11
- {brisc-0.2.4 → brisc-0.2.6}/brisc/leiden.pyx +18 -21
- {brisc-0.2.4 → brisc-0.2.6}/brisc/normalize.pyx +34 -22
- {brisc-0.2.4 → brisc-0.2.6}/brisc/pca.pyx +8 -6
- {brisc-0.2.4 → brisc-0.2.6}/brisc/pseudobulk.py +39 -18
- {brisc-0.2.4 → brisc-0.2.6}/brisc/pseudobulk_and_markers.pyx +20 -17
- {brisc-0.2.4 → brisc-0.2.6}/brisc/qc.pyx +32 -27
- {brisc-0.2.4 → brisc-0.2.6}/brisc/single_cell.py +114 -258
- {brisc-0.2.4 → brisc-0.2.6}/brisc/snn.pyx +3 -5
- {brisc-0.2.4 → brisc-0.2.6}/brisc/utils.py +23 -86
- {brisc-0.2.4 → brisc-0.2.6}/brisc.egg-info/PKG-INFO +3 -3
- {brisc-0.2.4 → brisc-0.2.6}/brisc.egg-info/scm_file_list.json +2 -0
- brisc-0.2.6/brisc.egg-info/scm_version.json +8 -0
- brisc-0.2.4/brisc.egg-info/scm_version.json +0 -8
- {brisc-0.2.4 → brisc-0.2.6}/.git_archival.txt +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/.gitattributes +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/.gitignore +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/LICENSE +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/MANIFEST.in +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/brisc/__init__.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/brisc/colorspacious.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/brisc/concatenate.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/brisc/de.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/brisc/hdf5.pyx +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/brisc/labels.pyx +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/brisc/loess.pyx +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/brisc/norm_factors.pyx +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/brisc/sparse.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/brisc/threadpoolctl.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/brisc/type_aliases.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/brisc/validated_dict.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/brisc.egg-info/SOURCES.txt +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/brisc.egg-info/dependency_links.txt +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/brisc.egg-info/requires.txt +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/brisc.egg-info/top_level.txt +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/pyproject.toml +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/setup.cfg +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/setup.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/tests/conftest.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/tests/make_test_data.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/tests/test_cluster.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/tests/test_de.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/tests/test_embedding.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/tests/test_hvg.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/tests/test_integration.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/tests/test_markers.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/tests/test_neighbors.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/tests/test_normalize.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/tests/test_pca.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/tests/test_pseudobulk.py +0 -0
- {brisc-0.2.4 → brisc-0.2.6}/tests/test_qc.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: brisc
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.6
|
|
4
4
|
Summary: Fast single-cell toolkit
|
|
5
5
|
Author-email: Michael Wainberg <m.wainberg@utoronto.ca>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -63,7 +63,7 @@ conda install -c conda-forge brisc
|
|
|
63
63
|
pip install brisc
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
conda is recommended because it sets up the fast MKL BLAS and some of the R packages brisc uses. With pip, you'll need to handle those yourself: see the [installation guide](https://brisc.run/installation.html) for details, including optional R integration (for differential expression, Seurat, and SingleCellExperiment support) via [ryp](https://github.com/
|
|
66
|
+
conda is recommended because it sets up the fast MKL BLAS and some of the R packages brisc uses. With pip, you'll need to handle those yourself: see the [installation guide](https://brisc.run/installation.html) for details, including optional R integration (for differential expression, Seurat, and SingleCellExperiment support) via [ryp](https://github.com/briscverse/ryp).
|
|
67
67
|
|
|
68
68
|
## Quick start
|
|
69
69
|
|
|
@@ -80,7 +80,7 @@ sc = SingleCell('data.h5ad')\
|
|
|
80
80
|
.neighbors()\
|
|
81
81
|
.shared_neighbors()\
|
|
82
82
|
.cluster(resolution=[0.25, 0.5, 1, 1.5, 2])\
|
|
83
|
-
.
|
|
83
|
+
.localmap()
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
### Label transfer
|
|
@@ -35,7 +35,7 @@ conda install -c conda-forge brisc
|
|
|
35
35
|
pip install brisc
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
conda is recommended because it sets up the fast MKL BLAS and some of the R packages brisc uses. With pip, you'll need to handle those yourself: see the [installation guide](https://brisc.run/installation.html) for details, including optional R integration (for differential expression, Seurat, and SingleCellExperiment support) via [ryp](https://github.com/
|
|
38
|
+
conda is recommended because it sets up the fast MKL BLAS and some of the R packages brisc uses. With pip, you'll need to handle those yourself: see the [installation guide](https://brisc.run/installation.html) for details, including optional R integration (for differential expression, Seurat, and SingleCellExperiment support) via [ryp](https://github.com/briscverse/ryp).
|
|
39
39
|
|
|
40
40
|
## Quick start
|
|
41
41
|
|
|
@@ -52,7 +52,7 @@ sc = SingleCell('data.h5ad')\
|
|
|
52
52
|
.neighbors()\
|
|
53
53
|
.shared_neighbors()\
|
|
54
54
|
.cluster(resolution=[0.25, 0.5, 1, 1.5, 2])\
|
|
55
|
-
.
|
|
55
|
+
.localmap()
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
### Label transfer
|
|
@@ -4,10 +4,9 @@ from cpython.exc cimport PyErr_CheckSignals
|
|
|
4
4
|
from cython.parallel cimport parallel, prange, threadid
|
|
5
5
|
from libc.string cimport memcpy
|
|
6
6
|
from libcpp.algorithm cimport lower_bound
|
|
7
|
-
from libcpp.pair cimport pair
|
|
8
7
|
from libcpp.vector cimport vector
|
|
9
8
|
from .cyutils cimport atomic_and, atomic_or, bit_width, get_thread_offset, \
|
|
10
|
-
integer, numeric, signed_integer
|
|
9
|
+
integer, numa_vector, numeric, signed_integer
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
ctypedef fused integer2:
|
|
@@ -281,7 +280,7 @@ def csr_sort_indices(const unsigned n_row,
|
|
|
281
280
|
unsigned num_threads):
|
|
282
281
|
cdef unsigned i, thread_index
|
|
283
282
|
cdef signed_integer row_start, row_end
|
|
284
|
-
cdef
|
|
283
|
+
cdef unsigned start_row, end_row
|
|
285
284
|
|
|
286
285
|
num_threads = min(num_threads, n_row)
|
|
287
286
|
if num_threads <= 1:
|
|
@@ -293,8 +292,9 @@ def csr_sort_indices(const unsigned n_row,
|
|
|
293
292
|
else:
|
|
294
293
|
with nogil, parallel(num_threads=num_threads):
|
|
295
294
|
thread_index = threadid()
|
|
296
|
-
|
|
297
|
-
|
|
295
|
+
start_row, end_row = \
|
|
296
|
+
get_thread_offset(Ap, thread_index, num_threads)
|
|
297
|
+
for i in range(start_row, end_row):
|
|
298
298
|
row_start = Ap[i]
|
|
299
299
|
row_end = Ap[i + 1]
|
|
300
300
|
sort_both_by_indices(&Aj[0] + row_start, &Aj[0] + row_end,
|
|
@@ -313,7 +313,7 @@ def get_csr_submatrix1(const unsigned n_row,
|
|
|
313
313
|
unsigned num_threads):
|
|
314
314
|
cdef unsigned i, thread_index, new_n_row = ir1 - ir0
|
|
315
315
|
cdef signed_integer new_nnz, jj, row_start, row_end
|
|
316
|
-
cdef
|
|
316
|
+
cdef unsigned start_row, end_row
|
|
317
317
|
|
|
318
318
|
Bp[0] = 0
|
|
319
319
|
num_threads = min(num_threads, new_n_row)
|
|
@@ -333,9 +333,9 @@ def get_csr_submatrix1(const unsigned n_row,
|
|
|
333
333
|
else:
|
|
334
334
|
with nogil, parallel(num_threads=num_threads):
|
|
335
335
|
thread_index = threadid()
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
for i in range(
|
|
336
|
+
start_row, end_row = \
|
|
337
|
+
get_thread_offset(Ap[ir0:ir1 + 1], thread_index, num_threads)
|
|
338
|
+
for i in range(start_row, end_row):
|
|
339
339
|
new_nnz = 0
|
|
340
340
|
row_start = Ap[ir0 + i]
|
|
341
341
|
row_end = Ap[ir0 + i + 1]
|
|
@@ -365,7 +365,7 @@ def get_csr_submatrix1_check(const unsigned n_row,
|
|
|
365
365
|
unsigned num_threads):
|
|
366
366
|
cdef unsigned i, thread_index, new_n_row = ir1 - ir0
|
|
367
367
|
cdef signed_integer new_nnz, jj, row_start, row_end
|
|
368
|
-
cdef
|
|
368
|
+
cdef unsigned start_row, end_row
|
|
369
369
|
cdef bint has_canonical_format = True, has_sorted_indices = True
|
|
370
370
|
|
|
371
371
|
Bp[0] = 0
|
|
@@ -392,9 +392,9 @@ def get_csr_submatrix1_check(const unsigned n_row,
|
|
|
392
392
|
else:
|
|
393
393
|
with nogil, parallel(num_threads=num_threads):
|
|
394
394
|
thread_index = threadid()
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
for i in range(
|
|
395
|
+
start_row, end_row = \
|
|
396
|
+
get_thread_offset(Ap[ir0:ir1 + 1], thread_index, num_threads)
|
|
397
|
+
for i in range(start_row, end_row):
|
|
398
398
|
new_nnz = 0
|
|
399
399
|
row_start = Ap[ir0 + i]
|
|
400
400
|
row_end = Ap[ir0 + i + 1]
|
|
@@ -431,7 +431,7 @@ def get_csr_submatrix1_sorted(const unsigned n_row,
|
|
|
431
431
|
unsigned num_threads):
|
|
432
432
|
cdef unsigned i, thread_index, new_n_row = ir1 - ir0
|
|
433
433
|
cdef signed_integer row_start, row_end, start_idx, end_idx
|
|
434
|
-
cdef
|
|
434
|
+
cdef unsigned start_row, end_row
|
|
435
435
|
|
|
436
436
|
Bp[0] = 0
|
|
437
437
|
num_threads = min(num_threads, new_n_row)
|
|
@@ -450,9 +450,9 @@ def get_csr_submatrix1_sorted(const unsigned n_row,
|
|
|
450
450
|
else:
|
|
451
451
|
with nogil, parallel(num_threads=num_threads):
|
|
452
452
|
thread_index = threadid()
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
for i in range(
|
|
453
|
+
start_row, end_row = \
|
|
454
|
+
get_thread_offset(Ap[ir0:ir1 + 1], thread_index, num_threads)
|
|
455
|
+
for i in range(start_row, end_row):
|
|
456
456
|
row_start = Ap[ir0 + i]
|
|
457
457
|
row_end = Ap[ir0 + i + 1]
|
|
458
458
|
if row_start < row_end:
|
|
@@ -485,7 +485,7 @@ def get_csr_submatrix2(const unsigned n_row,
|
|
|
485
485
|
unsigned num_threads):
|
|
486
486
|
cdef unsigned i, thread_index, new_n_row = ir1 - ir0
|
|
487
487
|
cdef signed_integer jj, kk
|
|
488
|
-
cdef
|
|
488
|
+
cdef unsigned start_row, end_row
|
|
489
489
|
|
|
490
490
|
num_threads = min(num_threads, new_n_row)
|
|
491
491
|
if num_threads <= 1:
|
|
@@ -503,9 +503,9 @@ def get_csr_submatrix2(const unsigned n_row,
|
|
|
503
503
|
else:
|
|
504
504
|
with nogil, parallel(num_threads=num_threads):
|
|
505
505
|
thread_index = threadid()
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
for i in range(
|
|
506
|
+
start_row, end_row = \
|
|
507
|
+
get_thread_offset(Ap[ir0:ir1 + 1], thread_index, num_threads)
|
|
508
|
+
for i in range(start_row, end_row):
|
|
509
509
|
kk = Bp[i]
|
|
510
510
|
for jj in range(Ap[ir0 + i], Ap[ir0 + i + 1]):
|
|
511
511
|
if Aj[jj] >= ic0 and Aj[jj] < ic1:
|
|
@@ -534,7 +534,7 @@ def get_csr_submatrix2_sorted(const unsigned n_row,
|
|
|
534
534
|
unsigned num_threads):
|
|
535
535
|
cdef unsigned i, thread_index, new_n_row = ir1 - ir0
|
|
536
536
|
cdef signed_integer jj, kk, start_idx, end_idx, row_start, row_end
|
|
537
|
-
cdef
|
|
537
|
+
cdef unsigned start_row, end_row
|
|
538
538
|
|
|
539
539
|
num_threads = min(num_threads, new_n_row)
|
|
540
540
|
if num_threads <= 1:
|
|
@@ -554,9 +554,9 @@ def get_csr_submatrix2_sorted(const unsigned n_row,
|
|
|
554
554
|
else:
|
|
555
555
|
with nogil, parallel(num_threads=num_threads):
|
|
556
556
|
thread_index = threadid()
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
for i in range(
|
|
557
|
+
start_row, end_row = \
|
|
558
|
+
get_thread_offset(Ap[ir0:ir1 + 1], thread_index, num_threads)
|
|
559
|
+
for i in range(start_row, end_row):
|
|
560
560
|
kk = Bp[i]
|
|
561
561
|
row_start = Ap[ir0 + i]
|
|
562
562
|
row_end = Ap[ir0 + i + 1]
|
|
@@ -828,7 +828,7 @@ def csr_column_index1(const unsigned n_idx,
|
|
|
828
828
|
unsigned num_threads):
|
|
829
829
|
cdef unsigned i, j, thread_index
|
|
830
830
|
cdef signed_integer new_nnz, jj
|
|
831
|
-
cdef
|
|
831
|
+
cdef unsigned start_row, end_row
|
|
832
832
|
|
|
833
833
|
# bincount(col_idxs)
|
|
834
834
|
num_threads = min(num_threads, n_row)
|
|
@@ -852,8 +852,9 @@ def csr_column_index1(const unsigned n_idx,
|
|
|
852
852
|
else:
|
|
853
853
|
with nogil, parallel(num_threads=num_threads):
|
|
854
854
|
thread_index = threadid()
|
|
855
|
-
|
|
856
|
-
|
|
855
|
+
start_row, end_row = \
|
|
856
|
+
get_thread_offset(Ap, thread_index, num_threads)
|
|
857
|
+
for i in range(start_row, end_row):
|
|
857
858
|
new_nnz = 0
|
|
858
859
|
for jj in range(Ap[i], Ap[i + 1]):
|
|
859
860
|
new_nnz = new_nnz + col_offsets[Aj[jj]]
|
|
@@ -880,7 +881,7 @@ def csr_column_index2(const long long[::1] col_order,
|
|
|
880
881
|
cdef unsigned row, thread_index
|
|
881
882
|
cdef signed_integer n, jj, j, offset, prev_offset, k
|
|
882
883
|
cdef bit_width v
|
|
883
|
-
cdef
|
|
884
|
+
cdef unsigned start_row, end_row
|
|
884
885
|
|
|
885
886
|
num_threads = min(num_threads, Ap.shape[0] - 1)
|
|
886
887
|
if num_threads <= 1:
|
|
@@ -903,8 +904,9 @@ def csr_column_index2(const long long[::1] col_order,
|
|
|
903
904
|
else:
|
|
904
905
|
with nogil, parallel(num_threads=num_threads):
|
|
905
906
|
thread_index = threadid()
|
|
906
|
-
|
|
907
|
-
|
|
907
|
+
start_row, end_row = \
|
|
908
|
+
get_thread_offset(Ap, thread_index, num_threads)
|
|
909
|
+
for row in range(start_row, end_row):
|
|
908
910
|
n = Bp[row]
|
|
909
911
|
for jj in range(Ap[row], Ap[row + 1]):
|
|
910
912
|
j = Aj[jj]
|
|
@@ -934,7 +936,6 @@ def csr_outer_index1(const integer[::1] row_indices,
|
|
|
934
936
|
cdef unsigned i, j, row, thread_index, \
|
|
935
937
|
num_row_indices = row_indices.shape[0]
|
|
936
938
|
cdef signed_integer new_nnz, jj
|
|
937
|
-
cdef pair[unsigned, unsigned] row_range
|
|
938
939
|
|
|
939
940
|
# bincount(col_indices)
|
|
940
941
|
num_threads = min(num_threads, num_row_indices)
|
|
@@ -986,7 +987,6 @@ def csr_outer_index2(const integer[::1] row_indices,
|
|
|
986
987
|
cdef unsigned i, row, num_row_indices = row_indices.shape[0]
|
|
987
988
|
cdef signed_integer n, jj, j, offset, prev_offset, k
|
|
988
989
|
cdef bit_width v
|
|
989
|
-
cdef pair[unsigned, unsigned] row_range
|
|
990
990
|
|
|
991
991
|
num_threads = min(num_threads, Ap.shape[0] - 1)
|
|
992
992
|
if num_threads <= 1:
|
|
@@ -1188,9 +1188,9 @@ def csr_tocsc(const unsigned n_row,
|
|
|
1188
1188
|
cdef unsigned col, row, thread_index, preceding_thread_index
|
|
1189
1189
|
cdef signed_integer n, cumsum, count, jj, dest, preceding_count, i, \
|
|
1190
1190
|
Bp_col, nnz = Ap[n_row]
|
|
1191
|
-
cdef
|
|
1192
|
-
cdef vector[
|
|
1193
|
-
cdef vector[
|
|
1191
|
+
cdef unsigned start_row, end_row
|
|
1192
|
+
cdef vector[numa_vector[unsigned]] thread_col_counts
|
|
1193
|
+
cdef vector[numa_vector[signed_integer]] thread_col_offsets
|
|
1194
1194
|
cdef unsigned* col_counts
|
|
1195
1195
|
cdef signed_integer* col_offsets
|
|
1196
1196
|
|
|
@@ -1241,9 +1241,10 @@ def csr_tocsc(const unsigned n_row,
|
|
|
1241
1241
|
thread_index = threadid()
|
|
1242
1242
|
thread_col_counts[thread_index].resize(n_col)
|
|
1243
1243
|
thread_col_offsets[thread_index].resize(n_col)
|
|
1244
|
-
|
|
1244
|
+
start_row, end_row = \
|
|
1245
|
+
get_thread_offset(Ap, thread_index, num_threads)
|
|
1245
1246
|
col_counts = thread_col_counts[thread_index].data()
|
|
1246
|
-
for row in range(
|
|
1247
|
+
for row in range(start_row, end_row):
|
|
1247
1248
|
for jj in range(Ap[row], Ap[row + 1]):
|
|
1248
1249
|
col = Aj[jj]
|
|
1249
1250
|
col_counts[col] += 1
|
|
@@ -1279,8 +1280,9 @@ def csr_tocsc(const unsigned n_row,
|
|
|
1279
1280
|
thread_col_counts[preceding_thread_index][col]
|
|
1280
1281
|
col_offsets[col] = preceding_count
|
|
1281
1282
|
|
|
1282
|
-
|
|
1283
|
-
|
|
1283
|
+
start_row, end_row = \
|
|
1284
|
+
get_thread_offset(Ap, thread_index, num_threads)
|
|
1285
|
+
for row in range(start_row, end_row):
|
|
1284
1286
|
for jj in range(Ap[row], Ap[row + 1]):
|
|
1285
1287
|
col = Aj[jj]
|
|
1286
1288
|
dest = col_offsets[col]
|