diff --git a/doubletdetection/doubletdetection.py b/doubletdetection/doubletdetection.py index f0793f0..a254fe4 100644 --- a/doubletdetection/doubletdetection.py +++ b/doubletdetection/doubletdetection.py @@ -192,7 +192,7 @@ def fit(self, raw_counts): (self._num_cells, self._num_genes) = self._raw_counts.shape if self.normalizer is None: # Memoize these; default normalizer treats these invariant for all synths - self._lib_size = np.sum(raw_counts, axis=1).A1 + self._lib_size = np.asarray(np.sum(raw_counts, axis=1)).ravel() self._normed_raw_counts = self._raw_counts.copy() inplace_csr_row_normalize_l1(self._normed_raw_counts) @@ -298,14 +298,14 @@ def _one_fit(self): ) else: # Follows doubletdetection.plot.normalize_counts, but uses memoized normed raw_counts - synth_lib_size = np.sum(self._raw_synthetics, axis=1).A1 + synth_lib_size = np.asarray(np.sum(self._raw_synthetics, axis=1)).ravel() aug_lib_size = np.concatenate([self._lib_size, synth_lib_size]) normed_synths = self._raw_synthetics.copy() inplace_csr_row_normalize_l1(normed_synths) aug_counts = sp_sparse.vstack((self._normed_raw_counts, normed_synths)) scaled_aug_counts = aug_counts * np.median(aug_lib_size) if self.pseudocount != 1: - aug_counts = np.log(scaled_aug_counts.A + 0.1) + aug_counts = np.log(scaled_aug_counts.toarray() + 0.1) else: aug_counts = np.log1p(scaled_aug_counts) del scaled_aug_counts