Skip to main content

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.

Installation

pip install mossn

For local development:

pip install -e .[test]

Input format

  • expression_data: a genes × samples pandas.DataFrame.
  • links: a dataframe containing protein1 and protein2. Additional confidence-score columns are allowed but are ignored by MOSSN.

Gene identifiers must match between the expression matrix and PPI network.

Single-omics MOSSN

For each sample, MOSSN IQR-normalizes expression, applies sigmoid edge correction, initializes RWR from genes above the 90th expression percentile, runs RWR (alpha=0.3), rank-normalizes node importance, and returns one score per reference PPI edge.

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)

edge_table has columns Sample, Node1, Node2, BaseWeight, and FinalWeight. BaseWeight is 1.0 for every PPI edge in standard MOSSN.

Use run_samples(...) to process all, or a selected subset, of matrix columns. The switches use_correction=False, use_rwr=False, and use_seed=False correspond to the noCorr, noRWR, and noSeed single-omics ablations.

Multi-omics models

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

MOSSN-Direct maintains a PPI graph only for the expression layer. Each auxiliary MET/CNV node is connected solely to its corresponding expression gene. Cross-layer 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"]
)

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.5

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

Source distribution (sdist)

Source distribution for mossn 0.1.5
File Size Uploaded Provenance Actions
mossn-0.1.5.tar.gz 3.0 MB Without provenance Details for mossn-0.1.5.tar.gz

Built distribution (wheel)

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

Total release size: 6.1 MB

Release files / mossn-0.1.5.tar.gz

Download URL mossn-0.1.5.tar.gz
Size 3.0 MB
Tags Source
SHA-256 checksum
How to use checksums
4ad0e3c8e41863a6c86ecc6635f93ce836d4816ad3f9822aa048ed6d187efda2
BLAKE2b-256 checksum
How to use checksums
747918035e41b703725046b1597d2f9af5e7217e2fabea217c2d9cb4d43f48d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.7

Release files / mossn-0.1.5-py3-none-any.whl

Download URL mossn-0.1.5-py3-none-any.whl
Size 3.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
0532911cfdb204128748146038f94a15e327dc30212173122cc80a788dd09a8f
BLAKE2b-256 checksum
How to use checksums
8f256d2223c14187b9c6897d2284e4d7bd225138e228b162a1381d5e02039a22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.7

Security for mossn 0.1.5

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.

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