|
8 | 8 | import warnings |
9 | 9 | from itertools import repeat |
10 | 10 |
|
11 | | -import leidenalg as la |
12 | 11 | import numpy as np |
13 | 12 | import pandas as pd |
14 | 13 | import zarr |
15 | | -from igraph import Graph |
16 | 14 | from scipy.sparse import coo_matrix, csr_matrix, hstack |
17 | 15 | from scipy.spatial.distance import pdist, squareform |
18 | | -from sklearn import metrics |
19 | 16 |
|
20 | 17 | from ._zarr_utils import (make_zarr_sparse, make_zarr_dense) |
21 | 18 | from ._clustering import (run_base_clustering, consensus_cluster_leiden) |
@@ -179,12 +176,11 @@ def ensemble( |
179 | 176 | ] |
180 | 177 | args = list(zip(data_iterator, hyperparam_iterator)) |
181 | 178 |
|
182 | | - print("starting ensemble clustering multiprocess") |
183 | | - # out = np.array(parmap(run_base_clustering, args, nprocs=nprocs)) |
| 179 | + print("Starting ensemble clustering multiprocess") |
184 | 180 | out = parmap(run_base_clustering, args, nprocs=nprocs) |
185 | 181 |
|
186 | 182 | try: |
187 | | - clust_out = hstack(out) # [x[0] for x in out] |
| 183 | + clust_out = hstack(out) |
188 | 184 | except Exception: |
189 | 185 | print( |
190 | 186 | "consensus_cluster.py, line 599, in ensemble: clust_out = hstack(out[:,0])" |
@@ -227,12 +223,11 @@ def consensus(n, bg, nprocs): |
227 | 223 | ## Run final consensus |
228 | 224 | res_ls = [x / 1000 for x in range(50, 975, 25)] # 0.05 to 0.95 inclusive by 0.025 |
229 | 225 |
|
230 | | - print("starting consensus multiprocess") |
| 226 | + print("Starting consensus multiprocess") |
231 | 227 | start_time = time.perf_counter() |
232 | 228 | bg_iterator = repeat(bg, len(res_ls)) |
233 | 229 | n_iterator = repeat(n, len(res_ls)) |
234 | 230 | args = list(zip(n_iterator, res_ls, bg_iterator)) |
235 | | - # out = np.array(parmap(consensus_cluster_leiden, args, nprocs=self.nprocs)) |
236 | 231 | out = parmap(consensus_cluster_leiden, args, nprocs=nprocs) |
237 | 232 |
|
238 | 233 | all_clusterings = [pd.DataFrame(x[0], dtype=int) for x in out] |
@@ -348,7 +343,7 @@ def consensus_cluster( |
348 | 343 | la_res_range = ( |
349 | 344 | int(la_res_range[0]), |
350 | 345 | int(la_res_range[1]), |
351 | | - ) # , per_iter_clust_assigns |
| 346 | + ) |
352 | 347 | bipartite = ensemble( |
353 | 348 | zarr_loc=zarr_loc, |
354 | 349 | reduction=reduction, |
|
0 commit comments