Skip to content

Repository files navigation

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

importscanpyasscimportenrichmapasem# Load your AnnData objectadata=sc.read_h5ad("PATH/TO/YOUR/DATA.h5ad")
# Define a gene setgene_set= ["CD3D", "CD3E", "CD8A"]
# Run scoringem.tl.score(
adata=adata,
gene_set=gene_set,
score_key="T_cell_signature",
smoothing=True, # by default,correct_spatial_covariates=True, # by defaultbatch_key=None# Set batch_key if working with multiple slides
)
# Visualiseem.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.

importspatialdata_ioassd# read in SpatialDatasdata=sd.visium_hd("PATH_TO_DATA_FOLDER/")
# convert to AnnDataadata=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

Copyright

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.

About

EnrichMap: Spatially-informed enrichment analysis for functional interpretation of spatial transcriptomics.

Topics

Resources

Stars

17 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages