MOSNA: Multi‑Omics Spatial Network Analysis
mosna is a Python package for spatial omics data analysis, designed to extract clinically relevant features from single-cell spatial measurements (transcriptomics, proteomics, multiplexed imaging). MOSNA reconstructs spatial networks, computes interaction and neighborhood statistics, and trains predictive models integrating clinical outcomes.
📖 Documentation: mosna.readthedocs.io · 📝 Changelog
Overview of the Analysis Pipeline
MOSNA’s workflow progresses through increasing analytical complexity, starting with broad hypotheses on cell proportions, then moving to interaction-based metrics (aka "assortativity"), and finally discovering spatial neighboroods (also called niches), leveraging machine learning at each step for predictive modeling.
The pipeline stages:
| Stage | Description |
|---|---|
| 1. Proportions | Quantify global cell-type frequencies |
| 2. Composed Variables | Ratios of proportions |
| 3. Assortativity and mixing matrices | Preferential interaction between cell types |
| 4. Neighbors Aggregation Statistics (NAS) | Cell neighborhoods (niches) from local omics data |
🔧 Installation
From PyPI
pip install mosna # core library (CPU)
pip install "mosna[notebooks]" # + what the example notebooks need
From source, using uv (recommended for development)
Install uv, then from the repository root:
uv sync # core library (CPU), Python 3.10 (pinned in .python-version)
uv sync --extra notebooks # + Jupyter kernel, scanpy, Excel/ODS readers for examples/
uv sync --all-extras # everything, including GPU (Linux + CUDA 12)
uv run python -c "import mosna"
Optional dependency groups (combine with several --extra):
| Extra | Content |
|---|---|
notebooks |
ipykernel, ipywidgets, scanpy, openpyxl, odfpy |
viz |
napari (with PyQt5) |
extras |
fastcluster, gudhi, torch_geometric |
scanit |
SCAN-IT's undeclared deps gudhi, torch_geometric (see below) |
gpu |
RAPIDS cupy, cudf, cuml, cugraph (CUDA 12, from pypi.nvidia.com) |
all |
notebooks + viz + extras |
SCAN-IT itself is not on PyPI (the scanit package there is unrelated): install it from GitHub with
pip install git+https://github.com/zcang/SCAN-IT, or with uv uv sync --extra scanit --group scanit.
tysserand (>= 1.0) is installed from PyPI.
To develop both libraries side by side, install your local copy on top: uv pip install -e ../tysserand.
Register the environment as a Jupyter kernel with uv run python -m ipykernel install --user --name mosna.
Using Conda (GPU-enabled)
conda create -n mosna-gpu -c rapidsai -c conda-forge -c nvidia -c pytorch \
rapids=23.04.01 python=3.10 cuda-version=11.2 pytorch=1.12.1 scanpy
conda activate mosna-gpu
pip install ipykernel ipywidgets
cd /path/to/mosna
pip install -e .
Without GPU
conda create -n mosna -c conda-forge python=3.10 scanpy
conda activate mosna
pip install ipykernel ipywidgets
pip install -e .
Detailed Steps and Analyses
1. Cell-type Proportions
- MOSNA computes proportions of cell types per sample.
- Performs statistical tests (e.g., Mann-Whitney U) to identify differences between groups (e.g., responder vs non-responder), correcting with Benjamini-Hochberg.
2. Composed Variables (Ratios)
- Computes first-order (cell-type ratios) and higher-order ratios.
- Enables detection of enriched features not obvious from absolute counts.
3. Spatial Interaction Metrics
- Uses tysserand to build spatial cell networks (e.g., Delaunay triangulation).
- Computes mixing matrices and assortativity coefficients (AC) for categorical attributes (cell types or marker positivity).
- Applies network attribute randomization and z‑scoring to account for cell type proportions bias.
- Identifies interacting cell-type pairs predictive of response (e.g., neutrophil self-interactions, CD8–B cell, etc...).
4. Neighbors Aggregation Statistics (NAS) & Niches
- Aggregates features (omics data) of each cell and its neighbors to compute local statistics (means, variances, proportions, etc...).
- Clusters these aggregated features (e.g., UMAP + k‑means) to define niches (local microenvironments).
5. Model Training and Feature Importance
- At each stage, MOSNA allows training elastic‑net penalized logistic regression (for binary outcome) or Cox Proportional Hazard (for survival) models with cross-validation.
- It reports peformance metrics, model coefficients, and identifies top predictive features.
- Typically, as feature sets become more refined (e.g., cell types interactions or niche proportions), predictive power increases.
References
- The core methodology and pipeline are published in bioRxiv, demonstrating its use on a spatial proteomics dataset of Cutaneous T-Cell Lymphoma (CTCL), generated with the CODEX technology with binary response, and on a a spatial proteomics dataset of breast cancer generated with the IMC technology, with survival (right-censored) data.
- MOSNA leverages tysserand for fast network construction applicable to any spatial omics data.
Contributions & License
- Contributions are welcome via GitHub pull requests and issues.
- Licensed under GPL‑3.0, involving open-access reuse conditions.
Summary
MOSNA provides:
- A reproducible, interpretable pipeline for spatial network analysis.
- Multiple layers of feature computation: proportions → interactions → niches.
- Predictive modeling tightly integrated with exploratory analysis.
- Support for diverse spatial omics platforms such as CODEX, MERFISH, CyCIF, Visium, etc.
Explore the example notebooks to get hands-on experience and adapt workflows to your own spatial omics datasets.
Metadata
Release files for mosna 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mosna-1.0.0.tar.gz | 101.3 kB | Without provenance | Details for mosna-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mosna-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for mosna-1.0.0-py3-none-any.whl |
Total release size: 189.1 kB
Release files / mosna-1.0.0.tar.gz
| Download URL | mosna-1.0.0.tar.gz |
|---|---|
| Size | 101.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57241f8eb6c32cd73906ed422ffa160f6b7f17b8edece3e5a12a0b6678c5a5a2
|
|
BLAKE2b-256 checksum How to use checksums |
cf7bb99400d8621970c805e86d7ce1481b4d7481d092bde501251aeba90211a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.9 {"installer":{"name":"uv","version":"0.11.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / mosna-1.0.0-py3-none-any.whl
| Download URL | mosna-1.0.0-py3-none-any.whl |
|---|---|
| Size | 87.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5328245e4d70d577a465bd1248d86f344667e55c337f51d5b5828a3c5f3a555c
|
|
BLAKE2b-256 checksum How to use checksums |
ff75de4b920ab0fbd0110009033aaf65684db9965bb77ac0a9dd5f5431d69561
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.9 {"installer":{"name":"uv","version":"0.11.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for mosna 1.0.0
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.