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.0.tar.gz (21.2 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.0-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nichemap-0.1.0.tar.gz
  • Upload date:
  • Size: 21.2 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.0.tar.gz
Algorithm Hash digest
SHA256 82a425f57cc67f6e1c59751d67489a91c0e887c367c5bf1ab9d699d569839675
MD5 a565d18ee9c07060d0b1fec0a162089e
BLAKE2b-256 c9622a6831143c5eae2fcd6f8dff71ac26bde33ce9e523c1c1c9a0906cd37193

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nichemap-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.6 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a0f501f37b332aff274d62bfb82dcc0e6a1ce7f1c05bb34d2efd27af7cadfd7
MD5 7ced4508e8baf132e8cbe0df40db1f80
BLAKE2b-256 e55ba203d5ed932e207cef7720f84315ed7c3989f64c962488973628a2701441

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