mossn
mossn implements MOSSN (Multi-Omics Single-Sample Network reweighting),
a framework for generating sample-specific protein-interaction network
(ssPIN) edge weights from a fixed reference PPI topology.
MOSSN does not infer new protein interactions. The input PPI supplies the
reference edge set and topology only: every retained PPI edge starts at a
uniform weight of 1.0. Its final, sample-specific weight is determined by
within-sample molecular signals and network propagation.
Highlights
- Single-sample and multi-sample workflows for sample-specific network scoring
- Works with either a PPI links table or a custom
networkx.Graph - Direct-coupled multi-omics workflow for integrating matched CNV/MET layers alongside expression
- Bundled example dataset (TCGA-BLCA expression + STRING PPI) for quick experiments and reproducible demos
Method Overview
For each sample, MOSSN:
- Filters the reference PPI and expression matrix down to their shared genes.
- IQR-normalizes expression and applies a sigmoid edge correction, scaled by
lam. - Runs random walk with restart (RWR), seeded from genes above the
seed_quantileexpression percentile (or a uniform prior when seeding is disabled). - Rank-normalizes node importance and combines it with the edge correction
to produce one
FinalWeightper reference PPI edge.
Installation
pip install mossn
For local development:
pip install -e .[test]
Core API
prepare_data(...): build the uniform-weight background network from a links table or anetworkx.Graphrun_single_sample(...): score one sample against that networkrun_samples(...): run the single-omics workflow across multiple samplesprepare_data_direct_coupled(...): build a direct-coupled multi-omics graph (expression + CNV/MET)run_direct_coupled_single_sample(...): score one sample in the direct-coupled multi-omics setting
Input Format
expression_data: a genes × samplespandas.DataFrame.links: a dataframe containingprotein1andprotein2. Additional confidence-score columns are allowed but are ignored by MOSSN.
Gene identifiers must match between the expression matrix and the PPI network.
Single-Omics MOSSN
import pandas as pd
from mossn import prepare_data, run_single_sample
links = pd.DataFrame({
"protein1": ["A", "A", "B"],
"protein2": ["B", "C", "C"],
})
expression = pd.DataFrame(
{"sample_1": [4.2, 7.1, 3.5], "sample_2": [5.3, 6.4, 2.8]},
index=["A", "B", "C"],
)
graph, base_weights, expression = prepare_data(expression, links=links)
edge_table = run_single_sample("sample_1", graph, base_weights, expression)
To process every sample in the expression matrix, use run_samples(...)
instead — it accepts the same keyword arguments as run_single_sample(...).
Parameters
lam(default2.0): strength of expression-based edge correctionrwr_alpha(default0.3): restart probability in the random walkseed_quantile(default0.9): expression quantile used to define seed genes
Ablation switches
use_correction=False— disable edge correction (noCorr)use_rwr=False— disable the random walk, use edge correction alone (noRWR)use_seed=False— use a uniform restart prior instead of expression-based seeds (noSeed)
Multi-Omics: MOSSN-Direct
All multi-omics functions expect an omic_data dictionary containing
"EXP" and, as needed, "MET" and/or "CNV" gene × sample dataframes.
Sample IDs are normalized by replacing - with _ and keeping the first 12
characters, matching the analysis workflow.
MOSSN-Direct maintains a PPI graph only for the expression layer. Each auxiliary MET/CNV node is connected solely to its corresponding expression gene, and cross-layer edge weights are based on within-sample cross-omics concordance.
from mossn import prepare_data_direct_coupled, run_direct_coupled_single_sample
graph, base_weights, omics, exp_genes = prepare_data_direct_coupled(
links, {"EXP": expression, "CNV": cnv}, coupled_omics=["CNV"]
)
edge_table = run_direct_coupled_single_sample(
"sample_1", graph, base_weights, omics, exp_genes, coupled_omics=["CNV"]
)
Output Format
Both workflows return a tidy edge table:
| Column | Meaning |
|---|---|
Sample |
Sample identifier |
Node1 |
First endpoint of the interaction |
Node2 |
Second endpoint of the interaction |
BaseWeight |
Background-network edge weight (1.0 for standard MOSSN) |
FinalWeight |
Sample-specific edge score returned by MOSSN |
Bundled Example Data
from mossn.example_data import load_example_expression, load_example_links
expression = load_example_expression()
links = load_example_links()
License
mossn is distributed under a research-only license. Non-commercial
research, teaching, and evaluation use are allowed. Commercial use requires
prior written permission from the copyright holder.
Metadata
Release files for mossn 0.1.6
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 |
|---|---|---|---|---|
| mossn-0.1.6.tar.gz | 3.0 MB | With provenance | Details for mossn-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mossn-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for mossn-0.1.6-py3-none-any.whl |
Total release size: 6.1 MB
Release files / mossn-0.1.6.tar.gz
| Download URL | mossn-0.1.6.tar.gz |
|---|---|
| Size | 3.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d18b384cf24e179b6b3dff6463ec062115a4dd2542548eceb1cf54b40fdc247
|
|
BLAKE2b-256 checksum How to use checksums |
222488a9ebc742ef1a74e3f96d24914d46b97dfd07777becc0b6d2e851e2c0d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.
Transparency logRelease files / mossn-0.1.6-py3-none-any.whl
| Download URL | mossn-0.1.6-py3-none-any.whl |
|---|---|
| Size | 3.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e812cf9a0dc305f089d98f60f9edfa539a5984bf288553eb835e83b9cbe2eab7
|
|
BLAKE2b-256 checksum How to use checksums |
42f5578f78ec80a9b0e2e63a4b5f12c23b622f9b9f6516b45b43e77f4546e570
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.
Transparency logSecurity for mossn 0.1.6
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mossn-0.1.6.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.
Transparency logA 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.