scviva.tools.harreman.hotspot.compute_local_correlation#
- scviva.tools.harreman.hotspot.compute_local_correlation(adata, genes=None, permutation_test=False, M=1000, seed=42, check_analytic_null=False, device='auto', verbose=False)[source]#
Computes pairwise local correlation between selected genes using a spatial weight matrix.
- Parameters:
- adata
AnnData Annotated data object (AnnData). Required keys in
adata.uns: - ‘gene_autocorrelation_results’ (ifgenesis None) - ‘layer_key’: layer inadatato extract counts from - ‘model’: statistical model to use for centering (e.g., ‘DANB’, ‘normal’) - ‘umi_counts’: per-cell UMI counts - optionally ‘sample_key’: key inadata.obsto use for per-sample normalization- genes
list|None List of genes to include in the correlation analysis. If None, selects genes with FDR < 0.05 from
adata.uns['gene_autocorrelation_results'], ordered by Z-score.- permutation_test
bool|None Whether to compute an empirical p-value and null distribution by permuting the data.
- M
int|None Number of permutations to perform if
permutation_testis True.- seed
int|None Random seed for permutation reproducibility.
- check_analytic_null
bool|None Whether to compute an analytic null distribution for the local correlation scores.
- device
device|str PyTorch device to run computations on. Defaults to CUDA if available.
- verbose
bool|None Whether to print progress and status messages.
- adata
- Returns:
None Results are stored in the following keys in
adata.uns:lcs,lc_zs,lc_z_pvals, andlc_z_FDR.