From 0d0c6a6ad061f1f20e7b982051415857f898f527 Mon Sep 17 00:00:00 2001 From: Charlotte Rich-Griffin <25774602+crichgriffin@users.noreply.github.com> Date: Wed, 12 Apr 2023 11:49:28 +0100 Subject: [PATCH] add logging to track change in nnb --- panpipes/python_scripts/batch_correct_bbknn.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/panpipes/python_scripts/batch_correct_bbknn.py b/panpipes/python_scripts/batch_correct_bbknn.py index 508d7e6f..d05900cf 100644 --- a/panpipes/python_scripts/batch_correct_bbknn.py +++ b/panpipes/python_scripts/batch_correct_bbknn.py @@ -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