Skip to main content

A spatial grid-based toolkit for niche identification and cell-type neighborhood analysis in spatial transcriptomics

Project description

NicheMap

NicheMap logo

NicheMap is a Python toolkit for spatial niche analysis in Xenium and other coordinate-resolved spatial transcriptomics data.

NicheMap supports two complementary workflows:

  • spatial niche identification from marker-gene signature scores
  • cell-type neighborhood analysis around annotated spatial structures

Installation

pip install nichemap

For local development from source:

git clone https://github.com/yihe-csu/NicheMap.git
cd NicheMap
pip install -e .

Quick Start

Spatial niche identification

from pathlib import Path

import nichemap as nm

adata = nm.preprocess.load_xenium_data(
    base_dir=r"F:\spatial_data_lung\SSc_1_1_2_raw",
    anno_file=r"F:\spatial_data_lung\ssc112_annotation_map.csv",
)

model = nm.NicheMap(
    adata=adata,
    score_id="ECM_score",
    sample_prefix="SSc_1_1_2",
    out_dir=Path("outputs/ECM_score"),
)

final_adata = model.run(
    gene_list_csv=r"F:\spatial_data_lung\marker_genes\ECM-gene.csv",
    bins=300,
    peak_intensity=1.5,
    exp_intensity=1.0,
)

Cell-type neighborhood analysis

import scanpy as sc
import nichemap.neighborhood as nh

adata = sc.read_h5ad("data/SSc_1_1_2_tutorial.h5ad")

results = nh.run_cell_type_neighborhood_analysis(
    adata=adata,
    target_regions=["Airway_wall"],
    hops=[1, 2, 3],
    structure_col="structure_label",
    cell_type_col="cell_type",
    output_dir="outputs/neighborhood",
    selected_cell_types=None,
    make_plots=True,
)

Documentation and Tutorials

Citation

If you use NicheMap in your work, please cite:

He, Y. et al. NicheMap: a spatial grid-based pipeline for niche identification
in spatial transcriptomics. (Manuscript in preparation)

License

NicheMap is released under the MIT License.

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

nichemap-0.1.1.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

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

nichemap-0.1.1-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

Details for the file nichemap-0.1.1.tar.gz.

File metadata

  • Download URL: nichemap-0.1.1.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for nichemap-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d68d9296f859ece1ba3ab4cba3b410474554ff92386b5dbc4c16474f6e1b1070
MD5 499aae096ec9ebf44acd587b0a4803f5
BLAKE2b-256 b8cf2f91377a751cbf9218ae5a36cad965fdd6eae17a34f7100d6055ec956459

See more details on using hashes here.

File details

Details for the file nichemap-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: nichemap-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 23.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for nichemap-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0192735253a5c07d945c46b3cf05baa383b93ea4f1dadadfd1d968d0ae4c0850
MD5 649ba074107e5c02d3f9df0cb5f164fb
BLAKE2b-256 db529a1902910e25549dcae2fc9ad85cdb0553565bf9f7f47da3ecabec2bb9bf

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