API Reference#

Main scoring function#

enrichmap.tl.score

Compute spatially smoothed and spatially corrected gene set enrichment scores for one or more gene signatures.

Helper functions#

These functions are used by the score function.

enrichmap.tl.infer_gene_weights

Infer gene weights based on the coefficient of variation (CV) of gene expression.

enrichmap.tl.build_signed_weights

Build a signed gene weight dictionary from upregulated and downregulated gene lists.

Main plotting function#

enrichmap.pl.spatial_enrichmap

Visualise spatial enrichment maps for given signatures using spatial scatter plots.

Geostatistical evaluations#

Functionalities to assess the smoothness of scores or input gene signature.

enrichmap.pl.spatial_metrics

Compute and visualise spatial metrics for different scoring methods in a given dataset.

enrichmap.pl.compare_morans_i

Compare spatial autocorrelation of EnrichMap scores across patients using permutation-standardised Moran's I.

enrichmap.pl.compare_wasserstein

Pairwise Wasserstein (earth mover's) distance between patients based on spatially embedded EnrichMap scores.

enrichmap.pl.compare_variograms

Fit empirical semivariograms to EnrichMap scores per patient and extract structural parameters for cross-patient comparison of spatial organisation.

enrichmap.pl.variogram

Compute empirical variograms to assess spatial dependence for any score key.

enrichmap.pl.variogram_all

Compute and plot empirical variograms for multiple score keys on the same plot.

enrichmap.pl.morans_correlogram

Plot Moran scatterplots (spatial correlograms) for one or multiple spatial libraries.

enrichmap.pl.cross_moran_scatter

Plot cross-Moran scatterplots: score_x vs spatial lag of score_y, per library or globally.

Signature associations#

enrichmap.pl.signature_correlation_heatmap

Plot a heatmap of correlations between gene set scores in adata.obs.

Gene-level visualisations#

enrichmap.pl.gene_contributions_heatmap

Spatial gene contribution heatmap with expression scaling and spatial ordering.

enrichmap.pl.gene_contributions_pca

Visualise gene contributions to a spatial gene signature using PCA-reduced scatter plot.