zhoux85 / STAligner

STAligner is a tool for alignment and integration of spatially resolved transcriptomics data.
MIT License
29 stars 5 forks source link

AttributeError when running Cal_Spatial_Net #18

Open ysun996 opened 6 months ago

ysun996 commented 6 months ago

Hi, I'm trying to use STAligner to integrate Curioseeker slide-seq samples together. When running Cal_Spatial_Net, I run into the following error: AttributeError: 'numpy.ndarray' object has no attribute 'toarray'.

This seems to stem from this line of code Cal_Spatial_Net: X = pd.DataFrame(adata.X.toarray()[:, ], index=adata.obs.index, columns=adata.var.index)

Is this an issue with how my data is formatted? Is there anything I can change to fix this error?

zhoux85 commented 6 months ago

Hi. The input count matrix adata.X should be sparse matrix. Please firstly perform the transformation as follows:

from scipy.sparse import csr_matrix
adata.X = csr_matrix(adata.X)

Hope it helps!