Skip to main content

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

Project description

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

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

enrichmap-0.1.25.tar.gz (75.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

enrichmap-0.1.25-py3-none-any.whl (41.0 kB view details)

Uploaded Python 3

File details

Details for the file enrichmap-0.1.25.tar.gz.

File metadata

  • Download URL: enrichmap-0.1.25.tar.gz
  • Upload date:
  • Size: 75.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.8

File hashes

Hashes for enrichmap-0.1.25.tar.gz
Algorithm Hash digest
SHA256 8b9d04f81e44c33244fa142ad6d1d964085851188676e808a76232d0ae9eca9e
MD5 d0578ea5a1ac027ef93f679cc390c06c
BLAKE2b-256 944d6ff887e3129737c90ecd44d41bf671c4f3a3d3dfe9857c4f6008d068ba09

See more details on using hashes here.

File details

Details for the file enrichmap-0.1.25-py3-none-any.whl.

File metadata

  • Download URL: enrichmap-0.1.25-py3-none-any.whl
  • Upload date:
  • Size: 41.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.8

File hashes

Hashes for enrichmap-0.1.25-py3-none-any.whl
Algorithm Hash digest
SHA256 92e85d9bdbb58a53e843acadcc73eb81e99cc1f66a8e2393a7ee125d88bc69f9
MD5 417a1e4cc6bd2bff5a93ca43ce23d8be
BLAKE2b-256 0d9511c477f2470e75b242ce0cfc0d54e5e392551a313bd7cada2a08553534ec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page