troutpy.tl.spatial_colocalization#
- troutpy.tl.spatial_colocalization(sdata, coord_keys=None, gene_key='gene', resolution=1000, square_size=20, n_threads=1, threshold_colocalized=1, copy=False)#
Computes spatial variability of extracellular RNA using Moran’s I.
- Parameters:
sdata (
SpatialData) – The spatial transcriptomics dataset in SpatialData format.coord_keys (
Optional[list] (default:None)) – The keys for spatial coordinates in the dataset (default: [‘x’, ‘y’]).gene_key (
str(default:'gene')) – The key for gene identifiers in the dataset (default: ‘gene’).n_neighbors – Number of neighbors to use for computing spatial neighbors (default: 10).
resolution (
int(default:1000)) – The resolution for kernel density estimation (default: 1000).square_size (
int(default:20)) – The square_size for kernel density estimation (default: 20).n_threads (
int(default:1)) – The number of threads for LazyKDE processing (default: 1).method – The mode for spatial autocorrelation computation (default: “moran”).
threshold_colocalized (
int(default:1)) – Minimum expression of two genes to consider them as colocalized if expressed together
- Returns:
sdata: spatialdata.SpatialData A spatialdata object containing Moran’s I values for each gene, in sdata.xrna_metadata.var, indexed by gene names.