From fb156c9f43389c1e2113915cba158ee7c18a9a92 Mon Sep 17 00:00:00 2001 From: ptajvar Date: Tue, 22 Oct 2024 13:59:21 +0200 Subject: [PATCH] explicitly check n_edges_to_split_doublet exists before using sum --- src/pixelator/annotate/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pixelator/annotate/__init__.py b/src/pixelator/annotate/__init__.py index ff19011e..747abf33 100644 --- a/src/pixelator/annotate/__init__.py +++ b/src/pixelator/annotate/__init__.py @@ -441,6 +441,8 @@ def anndata_metrics(adata: AnnData) -> AnnotateAnndataStatistics: metrics["fraction_potential_doublets"] = adata.obs[ "is_potential_doublet" ].mean() + + if "n_edges_to_split_doublet" in adata.obs: metrics["n_edges_to_split_potential_doublets"] = adata.obs[ "n_edges_to_split_doublet" ].sum()