From 0862bf505b9633592cd1a7e3b2ebe565411aeef6 Mon Sep 17 00:00:00 2001 From: Erick Armingol Date: Fri, 12 Apr 2024 18:49:07 +0100 Subject: [PATCH] Uses nanpercentile instead of percentile --- sccellfie/expression/aggregation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sccellfie/expression/aggregation.py b/sccellfie/expression/aggregation.py index 40372e0..695e18b 100644 --- a/sccellfie/expression/aggregation.py +++ b/sccellfie/expression/aggregation.py @@ -93,7 +93,7 @@ def agg_expression_cells(adata, groupby, layer=None, gene_symbols=None, agg_func AGG_FUNC = {'mean' : np.nanmean, 'median' : np.nanmedian, - '25p' : lambda x, axis: np.percentile(x, q=25, axis=axis), - '75p' : lambda x, axis: np.percentile(x, q=75, axis=axis), - 'trimean' : lambda x, axis: 0.5*np.percentile(x, q=50, axis=axis) + 0.25*(np.percentile(x, q=25, axis=axis) + np.percentile(x, q=75, axis=axis)) + '25p' : lambda x, axis: np.nanpercentile(x, q=25, axis=axis), + '75p' : lambda x, axis: np.nanpercentile(x, q=75, axis=axis), + 'trimean' : lambda x, axis: 0.5*np.nanpercentile(x, q=50, axis=axis) + 0.25*(np.nanpercentile(x, q=25, axis=axis) + np.nanpercentile(x, q=75, axis=axis)) } \ No newline at end of file