Skip to main content

EnrichMap: Spatially-aware gene set enrichment

EnrichMap

EnrichMap is a lightweight tool designed to compute and visualise enrichment scores of a given gene set or signature in spatial transcriptomics datasets across different platforms. It offers flexible scoring, batch correction, spatial smoothing and visual outputs for intuitive exploration of biological signatures.

EnrichMap workflow

Features

  • Fast computation of enrichment scores
  • Support for batch correction and spatial covariates
  • Built-in spatial smoothing
  • Visualisation tools for intuitive mapping
  • Easy integration with AnnData (.h5ad) objects

Installation

A conda environment is strongly recommended with python ≥ 3.10.

conda create -n enrichmap_env python=3.11
conda activate enrichmap_env

Then, install enrichmap via pip.

pip install enrichmap

or directly from GitHub:

pip install git+https://github.com/secrierlab/enrichmap.git

Basic usage

import scanpy as sc
import enrichmap as em

# Load your AnnData object
adata = sc.read_h5ad("PATH/TO/YOUR/DATA.h5ad")

# Define a gene set
gene_set = ["CD3D", "CD3E", "CD8A"]

# Run scoring
em.tl.score(
    adata=adata,
    gene_set=gene_set,
    score_key="T_cell_signature",
    smoothing=True, # by default,
    correct_spatial_covariates=True, # by default
    batch_key=None # Set batch_key if working with multiple slides
)

# Visualise
em.pl.spatial_enrichmap(
    adata=adata,
    score_key="T_cell_signature_score"
)

Important note: EnrichMap currently does not support reading in SpatialData format. However, users can simply convert SpatialData to legacy AnnData to use EnrichMap.

import spatialdata_io as sd
# read in SpatialData
sdata = sd.visium_hd("PATH_TO_DATA_FOLDER/")
# convert to AnnData
adata = to_legacy_anndata(sdata, include_images=True, table_name="square_008um", coordinate_system="downscaled_hires")

Documentation

Comprehensive documentation is available at: https://enrichmap.readthedocs.io/en/latest

Contributing

If you have ideas for new features or spot a bug, please open an issue or submit a pull request.

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE.

Citation

Celik C & Secrier M (2025). EnrichMap: Spatially-informed enrichment analysis for functional interpretation of spatial transcriptomics. biorxiv.com

This code is free and is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. See the GNU General Public License for more details.

Metadata

Release files for enrichmap 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for enrichmap 0.2.3
File Size Uploaded
enrichmap-0.2.3.tar.gz 75.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for enrichmap 0.2.3
File Interpreter ABI Platform
enrichmap-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 75.6 MB

Release files / enrichmap-0.2.3.tar.gz

Download URL enrichmap-0.2.3.tar.gz
Size 75.5 MB
Tags Source
SHA-256 checksum
How to use checksums
3f5920d45a3e8bd1f77bc54f915e62f1d80386cd33cc57d2401e9dfb5ab792fc
BLAKE2b-256 checksum
How to use checksums
6e0ed5e4ee87beeb6fb18c1f83b404abcc5f526e98d5c5a24821b6395f46d7e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / enrichmap-0.2.3-py3-none-any.whl

Download URL enrichmap-0.2.3-py3-none-any.whl
Size 70.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
433c85b13406257b8bfe351f8262f842cc41b31e4b3b36b41bb22458d29fda24
BLAKE2b-256 checksum
How to use checksums
adfc1865b3a91fc43514221944a520039333426bae236d32df02f3b0aa2f7a20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page