From 782d85c5ba96bbd2c944cc62377932175f87c5b5 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Fri, 11 Oct 2024 15:00:29 +0200 Subject: [PATCH] Use `counts` instead of `adata.X` --- muon/_atac/preproc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/muon/_atac/preproc.py b/muon/_atac/preproc.py index fee70cc..6df5b6d 100644 --- a/muon/_atac/preproc.py +++ b/muon/_atac/preproc.py @@ -96,14 +96,14 @@ def tfidf( tf = np.dot(n_peaks, counts) else: n_peaks = np.asarray(counts.sum(axis=1)).reshape(-1, 1) - tf = adata.X / n_peaks + tf = counts / n_peaks if scale_factor is not None and scale_factor != 0 and scale_factor != 1: tf = tf * scale_factor if log_tf: tf = np.log1p(tf) - idf = np.asarray(adata.shape[0] / adata.X.sum(axis=0)).reshape(-1) + idf = np.asarray(adata.shape[0] / counts.sum(axis=0)).reshape(-1) if log_idf: idf = np.log1p(idf)