troutpy.tl.in_out_correlation#
- troutpy.tl.in_out_correlation(sdata, extracellular_layer='segmentation_free_table', cellular_layer='table', n_neighbors=5, copy=None)#
Computes the correlation between intracellular and extracellular gene expressionusing k-nearest extracellular bins.
- Parameters:
sdata (spatialdata.SpatialData) – A SpatialData object containing both extracellular and cellular AnnData objects.
extracellular_layer (str) – Key for the extracellular AnnData object in sdata.
cellular_layer (str) – Key for the cellular AnnData object in sdata.
n_neighbors (int) – Number of nearest extracellular bins to consider for aggregation.
- Returns:
-correlation_results (
DataFrame) A DataFrame containing correlation values for each gene, with gene names as the indexand columns [‘SpearmanR’, ‘PValue’].