You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File ~/.conda/envs/py39/lib/python3.9/site-packages/muon/_atac/preproc.py:77, in tfidf(data, log_tf, log_idf, log_tfidf, scale_factor)
74 if log_tfidf:
75 tf_idf = np.log1p(tf_idf)
---> 77 adata.X = np.nan_to_num(tf_idf, 0)
File ~/.conda/envs/py39/lib/python3.9/site-packages/anndata/_core/anndata.py:688, in AnnData.X(self, value)
684 if sparse.issparse(self._adata_ref._X) and isinstance(
685 value, np.ndarray
686 ):
687 value = sparse.coo_matrix(value)
--> 688 self._adata_ref._X[oidx, vidx] = value
689 else:
690 self._X = value
File ~/.conda/envs/py39/lib/python3.9/site-packages/scipy/sparse/_index.py:137, in IndexMixin.__setitem__(self, key, x)
135 x = x.tocoo(copy=True)
136 x.sum_duplicates()
--> 137 self._set_arrayXarray_sparse(i, j, x)
138 else:
139 # Make x and i into the same shape
140 x = np.asarray(x, dtype=self.dtype)
File ~/.conda/envs/py39/lib/python3.9/site-packages/scipy/sparse/_compressed.py:827, in _cs_matrix._set_arrayXarray_sparse(self, row, col, x)
825 def _set_arrayXarray_sparse(self, row, col, x):
826 # clear entries that will be overwritten
--> 827 self._zero_many(*self._swap((row, col)))
829 M, N = row.shape # matches col.shape
830 broadcast_row = M != 1 and x.shape[0] == 1
File ~/.conda/envs/py39/lib/python3.9/site-packages/scipy/sparse/_compressed.py:947, in _cs_matrix._zero_many(self, i, j)
945 n_samples = len(i)
946 offsets = np.empty(n_samples, dtype=self.indices.dtype)
--> 947 ret = csr_sample_offsets(M, N, self.indptr, self.indices, n_samples,
948 i, j, offsets)
949 if ret == 1:
950 # rinse and repeat
951 self.sum_duplicates()
ValueError: could not convert integer scalar
I believe this is an issue that this particular preprocessing method doesn't handle views correctly. By convention, it should copy the data.
I'll mark this to be fixed for the next release, thank you!
Saw scverse/anndata#339
Trying
.copy()
If that works, shouldn't muon catch this error rather than computing the entire
tf_idf
matrix before failing?The text was updated successfully, but these errors were encountered: