Skip to main content

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.

Metadata

Release files for nichemap 0.1.1

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

Source distribution (sdist)

Source distribution for nichemap 0.1.1
File Size Uploaded Provenance Actions
nichemap-0.1.1.tar.gz 24.3 kB Without provenance Details for nichemap-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 48.0 kB

Release files / nichemap-0.1.1.tar.gz

Download URL nichemap-0.1.1.tar.gz
Size 24.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d68d9296f859ece1ba3ab4cba3b410474554ff92386b5dbc4c16474f6e1b1070
BLAKE2b-256 checksum
How to use checksums
b8cf2f91377a751cbf9218ae5a36cad965fdd6eae17a34f7100d6055ec956459
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.5

Release files / nichemap-0.1.1-py3-none-any.whl

Download URL nichemap-0.1.1-py3-none-any.whl
Size 23.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0192735253a5c07d945c46b3cf05baa383b93ea4f1dadadfd1d968d0ae4c0850
BLAKE2b-256 checksum
How to use checksums
db529a1902910e25549dcae2fc9ad85cdb0553565bf9f7f47da3ecabec2bb9bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.5

Security for nichemap 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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