scverse / squidpy

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

Squidpy comparative statistics #645

Open jamesMo84 opened 1 year ago

jamesMo84 commented 1 year ago

We’re looking to use squidpy to generate comparative spatial statistics across multiple samples. I see we can supply the sample key by library_key in squidpy.gr.spatial_neighbors so that the spatial graph is generated for each sample independently, but how does one then use squidpy.gr.nhood_enrichment, sq.gr.interaction_matrix, sq.gr.centrality_scores functions to generate ‘per sample’ statistics to compare between samples.

the adata.uns output from the ``.gr. functions returns arrays - how does one access the column/row names for these arrays?

thanks!

giovp commented 1 year ago

hi @jamesMo84

but how does one then use squidpy.gr.nhood_enrichment, sq.gr.interaction_matrix, sq.gr.centrality_scores functions to generate ‘per sample’ statistics to compare between samples.

to do this, unfortunately you'd have to iterate over each sample and compute the statistics separately, and then find a method to aggregate/compare

some of these ideas were discussed here: https://github.com/scverse/squidpy/issues/483

I'm still not super sure how to expose the comparison/aggregations functions to perform cross-samples comparisons.