Skip to content

Commit

Permalink
Fix #215
Browse files Browse the repository at this point in the history
  • Loading branch information
grst committed Apr 7, 2021
1 parent a732450 commit 801e359
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions scirpy/_tools/_clonotypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ def define_clonotype_clusters(
adata.obs[key_added] = clonotype_cluster_series
adata.obs[key_added + "_size"] = clonotype_cluster_size_series
adata.uns[key_added] = clonotype_distance_res
logging.info(f'Stored clonal assignments in `adata.obs["{key_added}"]`.')
else:
return (
clonotype_cluster_series,
Expand Down
8 changes: 5 additions & 3 deletions scirpy/ir_dist/_clonotype_neighbors.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from multiprocessing import cpu_count
from typing import Union, Sequence, Tuple, Dict
from typing import Union, Sequence
from anndata import AnnData
from tqdm.contrib import tmap
from scanpy import logging
from .._compat import Literal
import numpy as np
Expand Down Expand Up @@ -219,7 +218,10 @@ def compute_distances(self) -> sp.csr_matrix:
# only use multiprocessing for sufficiently large datasets
# for small datasets the overhead is too large for a benefit
if self.n_jobs == 1 or n_clonotypes <= 2 * self.chunksize:
dist_rows = tqdm(self._dist_for_clonotype(i) for i in range(n_clonotypes))
dist_rows = tqdm(
(self._dist_for_clonotype(i) for i in range(n_clonotypes)),
total=n_clonotypes,
)
else:
logging.info(
"NB: Computation happens in chunks. The progressbar only advances "
Expand Down

0 comments on commit 801e359

Please sign in to comment.