Skip to content

Commit

Permalink
add logging to track change in nnb
Browse files Browse the repository at this point in the history
  • Loading branch information
crichgriffin committed Apr 12, 2023
1 parent f411525 commit 0d0c6a6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions panpipes/python_scripts/batch_correct_bbknn.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,13 @@

# make sure that batch is a categorical
adata.obs["comb_columns"] = adata.obs["comb_columns"].astype("category")
# test the minimum number of neighbours needed for the function to not break,
# the safe point is 40 in my tests
nn_test = nnb * len(adata.obs["comb_columns"].unique())
if nn_test > 40:
nnb = nnb - 1
L.info("reducing the numbers within batch to %i as the number of batches is high, \
and bbknn will likely crash" % nnb)
if nnb < 1:
sys.exit("can't work with 0 neighbors_within_batch")
# run bbknn
Expand Down

0 comments on commit 0d0c6a6

Please sign in to comment.