Skip to main content

Xenium I/O, multimodal analysis, topology workflows, contour-native spatial profiling, GMI inference, and mechanostress analysis.

Project description

pyXenium horizontal logo

pyXenium

Xenium I/O, multimodal analysis, topology workflows, contour-native spatial profiling, GMI inference, and mechanostress analysis.

PyPI version Read the Docs CI Python versions License

PyPI · Read the Docs · GitHub · Changelog · Releases

pyXenium is a Python toolkit for 10x Genomics Xenium with seven canonical public surfaces:

  • pyXenium.io: Xenium artifact loading, partial export recovery, SData I/O, and SpatialData-compatible export.
  • pyXenium.multimodal: canonical RNA + protein loading, joint analysis, immune-resistance scoring, and packaged workflows.
  • pyXenium.ligand_receptor: topology-native ligand-receptor analysis.
  • pyXenium.pathway: pathway topology analysis and pathway activity scoring.
  • pyXenium.contour: contour import, contour expansion, and contour-aware density profiling around polygon annotations.
  • pyXenium.gmi: contour-level GMI modeling for sparse main-effect and interaction discovery in spatial transcriptomics.
  • pyXenium.mechanostress: morphology-derived mechanical stress states, including fibroblast axis strength, tumor-stroma growth patterning, and cell polarity.

Legacy compatibility entry points under pyXenium.analysis, pyXenium.validation, and pyXenium.io.load_xenium_gene_protein(...) remain importable, but new code should target the canonical namespaces above.

Release & Build

Install

pip install pyXenium==0.4.1

For local development:

git clone https://github.com/hutaobo/pyXenium
cd pyXenium
pip install -e ".[dev]"

For documentation work:

pip install -e ".[docs]"

Quick examples

Xenium I/O

from pyXenium.io import read_xenium

sdata = read_xenium("/path/to/xenium_export", as_="sdata", prefer="zarr")

Canonical multimodal loading

from pyXenium.multimodal import load_rna_protein_anndata

adata = load_rna_protein_anndata(
    base_path="/path/to/xenium_export",
    prefer="auto",
)

Contour expansion

from pyXenium.contour import expand_contours

expand_contours(
    sdata,
    contour_key="protein_cluster_contours",
    distance=25.0,
    mode="voronoi",
)

Contour-GMI inference

from pyXenium.gmi import ContourGmiConfig, run_atera_breast_contour_gmi

result = run_atera_breast_contour_gmi(
    dataset_root="/path/to/WTA_Preview_FFPE_Breast_Cancer_outs",
    output_dir="pyxenium_gmi_outputs/atera_s1_s5",
    config=ContourGmiConfig(feature_count=500, spatial_feature_count=100),
)

pyXenium.gmi is a canonical beta surface: the API is public, while biological interpretation should be checked with the bundled controls, cross-validation, and PDC Slurm reproducibility workflow. The Atera S1/S5 validation completed on PDC Dardel in the v0.4.1 release, supporting an S5/DCIS RNA program led by NIBAN1 and SORL1 under the QC20 primary model.

Mechanostress analysis

from pyXenium.io import read_xenium
from pyXenium.mechanostress import MechanostressConfig, run_mechanostress_workflow

sdata = read_xenium("/path/to/xenium_export", as_="sdata", include_boundaries=True)
result = run_mechanostress_workflow(
    sdata,
    output_dir="pyxenium_mechanostress_outputs/sample_1",
    config=MechanostressConfig(),
)

For cohorts organized as one Xenium sample per directory, use:

from pyXenium.mechanostress import MechanostressConfig, run_mechanostress_cohort

cohort = run_mechanostress_cohort(
    "/path/to/headandneckSCC",
    output_dir="pyxenium_mechanostress_outputs/hnscc",
    config=MechanostressConfig(coupling_genes=("KRT5", "EPCAM")),
)

pyXenium.mechanostress is a canonical beta surface for extracting mechanical stress signals from Xenium morphology and spatial cell context.

Documentation structure

The docs mirror the package surfaces and high-level workflows:

  • Installation / Quickstart
  • User Guide
  • Workflows
  • API Reference
  • Changelog

Start here: pyxenium.readthedocs.io

Branding assets

The repository keeps its Read the Docs, GitHub, and PyPI branding assets under:

docs/_static/branding/

Use the derived horizontal PNG for README, PyPI, and GitHub social preview surfaces:

docs/_static/branding/pyxenium-horizontal-dark.png

The canonical source artwork remains docs/_static/branding/pyxenium-horizontal-dark.svg.

License

Copyright (c) 2025 Taobo Hu. All rights reserved.

This project is source-available, not open source. You may use, modify, and redistribute it only for non-commercial purposes under the terms of the LICENSE file. Commercial use requires prior written permission from the copyright holder.

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

pyxenium-0.4.1.tar.gz (384.7 kB view details)

Uploaded Source

Built Distribution

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

pyxenium-0.4.1-py3-none-any.whl (392.2 kB view details)

Uploaded Python 3

File details

Details for the file pyxenium-0.4.1.tar.gz.

File metadata

  • Download URL: pyxenium-0.4.1.tar.gz
  • Upload date:
  • Size: 384.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for pyxenium-0.4.1.tar.gz
Algorithm Hash digest
SHA256 05e455930cf8bfdff31c0bc66ba4447fdfe8a69c571abf30a9a8ccca56e3970d
MD5 425a6bf8231b7defe38c6c2478f7c162
BLAKE2b-256 40198b4ebf2f3bc9cc3b9b77d84769fc8c2ee1c89eeadfb105ac3088ce4e24d7

See more details on using hashes here.

File details

Details for the file pyxenium-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: pyxenium-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 392.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for pyxenium-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4c51142c0ed668c0438eab6ca133b3b220d8b0052eaf218495fac644cc48c15d
MD5 71774d4d17771283030e9ad8c89c625e
BLAKE2b-256 81b51d4bc95be4915a665ec79529b153b0756d8f0295bc9fd8cf58a49f4bfcb2

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