Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doubletdetection/doubletdetection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
Loading