Closed THZ34 closed 10 months ago
The exp_matrix
should be a sparse matrix, what did you do before cell_cell_communication?
We instantiated an adata object from counts, and then converted it into a stereo object. count = pd.read_csv("counts.csv", index_col=0) adata = sc.read_h5ad("srt.h5ad") adata2 = sc.AnnData(count.T, # obs=adata.obs, obsm={"spatial": adata.obs[["x_FOV_px", "y_FOV_px"]].values}, dtype=np.int64) adata2.obs = adata.obs data = st.io.anndata_to_stereo(adata2, use_raw=False, spatial_key="spatial", resolution=500)
adata2.X is a dense matrix
In line:323 of stereo/algorithm/cell_cell_communication/main.py data = pd.DataFrame(self.stereo_exp_data.exp_matrix.T.toarray())
self.stereo_exp_data.exp_matrix is a np.array() object, so it don't need to use the toarray method.