From 77ae355f909a975b50a34ba6eb1292bec3accbcf Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Tue, 28 Jul 2026 12:29:32 +0200 Subject: [PATCH 1/3] compute average_batch_r2 per cell type * Pass the cell type subsets to batch_r2() instead of the donor-level views * Correct the cell count in the skip comment --- src/metrics/average_batch_r2/script.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/metrics/average_batch_r2/script.py b/src/metrics/average_batch_r2/script.py index 93fbd6204..290db65b4 100644 --- a/src/metrics/average_batch_r2/script.py +++ b/src/metrics/average_batch_r2/script.py @@ -63,13 +63,13 @@ s2_view_ct = s2_view[s2_view.obs["cell_type"] == ct] if ( s1_view_ct.shape[0] < 20 or s2_view_ct.shape[0] < 20 - ): # Skip Rˆ2 calculation if there are less than 10 cells + ): # Skip Rˆ2 calculation if there are less than 20 cells print( f"Warning: Rˆ2 not computed for donor {donor} cell type {ct}. Too few cells were present: {s1_view_ct.shape[0]} for split 1 and {s2_view_ct.shape[0]} for split 2" ) continue - r2_list, marker_list = batch_r2(s1_view, s2_view) + r2_list, marker_list = batch_r2(s1_view_ct, s2_view_ct) marker_list = [ct + "_" + donor + "_" + x for x in marker_list] r2_info = [*r2_info, *marker_list] From 9cdefb0d09f9e7f39216daaad828ce914fb0d160 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Tue, 28 Jul 2026 12:31:15 +0200 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 271fda0d5..431ec6643 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -239,4 +239,6 @@ and thus can't be directly overriden (new values given by get_donor_batch_map is int) (PR #119). * Update flowsom mapping similarity so we subset to just markers to correct, and lisi to remove control samples - and unlabelled cells (PR #119). \ No newline at end of file + and unlabelled cells (PR #119). +* Fix bug in `average_batch_r2` where the R2 was computed on all cell types of a donor at once + instead of on each cell type separately (PR #127). From f119b337fec52acf45030fd2ee58e29519a4e9b9 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Tue, 28 Jul 2026 12:43:05 +0200 Subject: [PATCH 3/3] fix changelog spacing --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 431ec6643..452a98dd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -240,5 +240,6 @@ * Update flowsom mapping similarity so we subset to just markers to correct, and lisi to remove control samples and unlabelled cells (PR #119). + * Fix bug in `average_batch_r2` where the R2 was computed on all cell types of a donor at once instead of on each cell type separately (PR #127).