Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs discovery for single-cell level spatialDM #25

Open
HelloWorldLTY opened this issue Nov 7, 2023 · 5 comments
Open

Bugs discovery for single-cell level spatialDM #25

HelloWorldLTY opened this issue Nov 7, 2023 · 5 comments

Comments

@HelloWorldLTY
Copy link

Hi, I met a bug when inferring cci in image-based spatial data:

sdm.weight_matrix(adata, l=1.2, cutoff=0.2, single_cell=True) # weight_matrix by rbf kernel

image

Could you please take a look? Thanks.

@HelloWorldLTY
Copy link
Author

There is a following-up question for this step:

image

It seems that there still exists errors and warnings for this step. Moreover, for running a spatial datasetsw ith 4,000 cells and 150,000 genes, cellphonedb is obviously faster than spatialDM (10 mins vs 16 hours), which is not consistent with the efficiency plot shown in the readme file. Are there any approaches to acclecrate spatialDM? Thanks.

@ABU-TO
Copy link

ABU-TO commented Jan 8, 2024

sdm.weight_matrix(adata, l=120, cutoff=0.2, single_cell=False) # weight_matrix by rbf kernel
The parameter ‘l =120’ here might solve this problem.

Also, I found that the parallel parameter ‘nproc=8’ can significantly reduce the processing time.

@HelloWorldLTY
Copy link
Author

HelloWorldLTY commented Jan 8, 2024

Hi, I met same problem here even if I tried both l=120 or l=1200. I think there is lack of information for us to choose a good initial value of l and cutoff. Moreover, I need to set single_cell=True because I am handling single-cell data (like MERFISH).

Also I tried to set nproc = 8, the time usage is the same as nproc =1.

@Feanor007
Copy link

Feanor007 commented Jan 28, 2024

@HelloWorldLTY
The

flat not found error

is caused by applying numpy methods on csr_matrix. The following code should solve it:

if singlecell:
# Convert csr_matrix to lil_matrix for efficient row operations
    rbf_d_lil = rbf_d.tolil()

    # Set diagonal elements to zero
    rbf_d_lil.setdiag(0)

    # Convert back to csr_matrix if needed
    rbf_d = rbf_d_lil.tocsr()

@Rafael-Silva-Oliveira
Copy link

Hi, I met same problem here even if I tried both l=120 or l=1200. I think there is lack of information for us to choose a good initial value of l and cutoff. Moreover, I need to set single_cell=True because I am handling single-cell data (like MERFISH).

Also I tried to set nproc = 8, the time usage is the same as nproc =1.

I've been trying with VisiumHD data which now can have from 150k to 650k + spots (barcodes) so I think at this stage SpatialDM isn't quite compatible with single-cell level resolution for spatial data unfortunately

joan-yanqiong added a commit to joan-yanqiong/SpatialDM that referenced this issue May 17, 2024
try proposed fix according to StatBiomed#25 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants