scverse / squidpy

Spatial Single Cell Analysis in Python
https://squidpy.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
428 stars 79 forks source link

Memory Consumption Issue in CosMx. #786

Closed ayumatsubo closed 3 months ago

ayumatsubo commented 9 months ago

Dear squidpy developers,

Thank you for creating this useful tool. Squidpy has been extremely helpful in the analysis of spatial transcriptome data, aiding our research.

Currently, we are performing analyses by integrating several CosMx datasets. While Squidpy's read.nanostring function efficiently loads images compared to other tools, it still consumes a significant amount of memory (maybe because loading the image data).

As we anticipate conducting large-scale analyses in the future, and since image data is unnecessary except for visualization purposes, could you please create a function that loads data without images to save memory?

Thank you in advance for your assistance.

LLehner commented 3 months ago

Hi @ayumatsubo, for loading CosMx datasets efficiently I would highly recommend to use spatialdata-io, which has a reader for CosMx called cosmx(). In general spatialdata, which utilizes zarr, is extremely efficient with images and should therefore be used to handle any spatial omics data.

After you read your data into an sdata object, it's recommended to write it to a zarr store via sdata.write("data.zarr").