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

sq.gr.ligrec crashing kernel/script with VisiumHD (>100k spots/spatial barcodes) - Squidpy incompatible with single-cell level spatial technologies? #819

Closed
Rafael-Silva-Oliveira opened this issue Apr 18, 2024 · 4 comments

Comments

@Rafael-Silva-Oliveira
Copy link

Rafael-Silva-Oliveira commented Apr 18, 2024

Description

VisiumHD will now become one of the standards for single-cell level resolution on spatial data, but this seems to be too much for squidpy to handle as of now.

...

Minimal reproducible example (MRE)

No mre available, but I'm using this dataset that is publicly available: https://www.10xgenomics.com/datasets/visium-hd-cytassist-gene-expression-libraries-of-human-lung-cancer-if

I perform clustering with scanpy (leiden_clusters) using the 16 micron resolution that has 152k spots/barcodes and then try to use this as the "cluster_key" on sq.gr.ligrec:

res = sq.gr.ligrec(adata=adata,     
    n_perms=100,
    cluster_key="leiden_clusters",
    copy=True,
    use_raw=False,
    transmitter_params={"categories": "ligand"},
    receiver_params={"categories": "receptor"},
)

If I try this with a smaller FFPE Visium dataset (< 10k spots), I can run it and see the results just fine.

Changing permutations on the new VisiumHD doesn't change anything.

Traceback

No traceback, kernel/script simply crashes with no information other than:

The Kernel crashed while executing code in the the current cell or a previous cell. Please review the code in the cell(s) to identify a possible cause of the failure. Click [here](https://aka.ms/vscodeJupyterKernelCrash) for more info. View Jupyter [log](command:jupyter.viewOutput) for further details.

Version

python 3.10.2
squidpy 1.4.1
scanpy 1.9.6

Similar to this issue: #812 where it crashes with 50k spots, I wonder if squidpy will allow for higher resolution to be used since that's the direction where spatial technologies are heading towards? @giovp

I tested with subsets of the main VisiumHD and MERFISH data and the kernel starts crashing between 30k and 35k spots which makes using new spatial single-cell level technologies not compatible with squidpy

@Rafael-Silva-Oliveira Rafael-Silva-Oliveira changed the title sq.gr.ligrec crashing kernel/script with VisiumHD (>100k spots/spatial barcodes) sq.gr.ligrec crashing kernel/script with VisiumHD (>100k spots/spatial barcodes) - Squidpy incompatible with single-cell level spatial technologies? Apr 18, 2024
@giovp
Copy link
Member

giovp commented Apr 22, 2024

hi @Rafael-Silva-Oliveira , could increase the memory available on your system and try to run it again>?

@Rafael-Silva-Oliveira
Copy link
Author

Rafael-Silva-Oliveira commented Apr 22, 2024

hi @Rafael-Silva-Oliveira , could increase the memory available on your system and try to run it again>?

Hi I'm currently not running on a server, but I will in a few weeks. My local specs are 32gb RAM, i7 and NVIDIA RTX A1000 6gb

I'm positive that this would work okay in a server with more memory, but it would be quite nice if squidpy was optimized to support single-cell level spatial data locally (at least to support 100-200k spots)! :)

@giovp
Copy link
Member

giovp commented Apr 22, 2024

I think we might be hitting performance issues on various tools on squidpy with this huge number of cells. I think make the algorithms more memory efficient is not trivial though

@Rafael-Silva-Oliveira
Copy link
Author

I think we might be hitting performance issues on various tools on squidpy with this huge number of cells. I think make the algorithms more memory efficient is not trivial though

Thank you for the reply! Would be great if these changes were implemented, but in the meantime I'm open to suggestion that handle HD data :) I'll be testing Liana, but I'll see if it supports such high resolution as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants