Skip to content

Commit ae68ce3

Browse files
rcannoodghar1821
andauthored
Compute average_batch_r2 per cell type (#127)
* 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 * update changelog * fix changelog spacing --------- Co-authored-by: Givanna Putri <givanna.h@gmail.com>
1 parent aaf33db commit ae68ce3

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,7 @@
248248
as scalars instead of lists, as required by `file_score.yaml` (PR #130).
249249

250250
* Clean up stale mock parameters and dead code (PR #133).
251+
252+
253+
* Fix bug in `average_batch_r2` where the R2 was computed on all cell types of a donor at once
254+
instead of on each cell type separately (PR #127).

src/metrics/average_batch_r2/script.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@
6060
s2_view_ct = s2_view[s2_view.obs["cell_type"] == ct]
6161
if (
6262
s1_view_ct.shape[0] < 20 or s2_view_ct.shape[0] < 20
63-
): # Skip Rˆ2 calculation if there are less than 10 cells
63+
): # Skip Rˆ2 calculation if there are less than 20 cells
6464
print(
6565
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"
6666
)
6767
continue
6868

69-
r2_list, marker_list = batch_r2(s1_view, s2_view)
69+
r2_list, marker_list = batch_r2(s1_view_ct, s2_view_ct)
7070

7171
marker_list = [ct + "_" + donor + "_" + x for x in marker_list]
7272
r2_info = [*r2_info, *marker_list]

0 commit comments

Comments
 (0)