Protein-complex activity scoring via network propagation (RWR on sample-specific PPI networks)
Project description
netComplex
netComplex scores protein-complex activity across samples by propagating gene expression signals through a sample-specific protein–protein interaction (PPI) network via Random Walk with Restart (RWR).
Algorithm overview
- Filter — retain only genes present in both the PPI network and the expression matrix.
- Rank-normalize — convert each sample's expression values to ranks in (0, 1].
- Re-weight edges — scale PPI edge scores by the expression ranks of both endpoints:
weight = BaseScore × (rank_u × rank_v)^β. - RWR — propagate the ranked expression as a restart signal over the weighted network to obtain node-level scores.
- Complex scoring — for each complex aggregate node scores into:
- BaseActivity — expression-weighted mean of propagated node scores.
- Coherence — mean pairwise score similarity across retained members × size penalty
k/(k+1). - ComplexScore = BaseActivity × Coherence.
Installation
pip install netComplex
Quick start
import pandas as pd
from netcomplex import compute_all_sample_complex_scores, build_complex_score_matrix
# links: DataFrame with columns protein1, protein2, score
# expression_data: DataFrame, genes as index, samples as columns
# complex_data: DataFrame with columns Complex, Genes (semicolon-delimited)
scores = compute_all_sample_complex_scores(
links=links,
expression_data=expression_data,
complex_data=complex_data,
rwr_alpha=0.3, # restart probability
beta=0.5, # edge re-weighting exponent
gamma=1.0, # coherence pairwise-similarity exponent
)
# Long-format table (one row per sample-complex pair)
print(scores.head())
# Wide-format matrix (complexes × samples)
matrix = build_complex_score_matrix(scores)
API reference
| Function | Description |
|---|---|
prepare_data(links, expression_data) |
Filter shared genes and build base PPI graph. |
run_rwr(sample_id, G, real_original_weights, expression_data, ...) |
Re-weight edges and run RWR for one sample. |
compute_complex_score(sample_id, p_star, expression_ranked, complex_data, ...) |
Score all complexes for one sample. |
compute_all_sample_complex_scores(links, expression_data, complex_data, ...) |
Run the full pipeline across all samples. |
build_complex_score_matrix(all_complex_scores) |
Pivot long-format scores to a complex × sample matrix. |
rank_normalize_series(sample_expression) |
Rank-normalize a single expression series to (0, 1]. |
Input formats
links — PPI network:
| protein1 | protein2 | score |
|---|---|---|
| EGFR | ERBB2 | 0.9 |
expression_data — gene × sample matrix (genes as row index, samples as column names).
complex_data — complex membership:
| Complex | Genes |
|---|---|
| COP9 signalosome | COPS1;COPS2;COPS3 |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file netcomplex-0.1.0.tar.gz.
File metadata
- Download URL: netcomplex-0.1.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9670758b9c842f0ae6ee0d1fec6158ea7c257b809efa567f7b4e947cc08ee425
|
|
| MD5 |
7c890a810d250dff165574417a8162e6
|
|
| BLAKE2b-256 |
f34ea57bd43228c885712362365352fc8ed05b64995db1c6b4939a2edc065fb5
|
File details
Details for the file netcomplex-0.1.0-py3-none-any.whl.
File metadata
- Download URL: netcomplex-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1b85feeeecea9856150a33a255ad6c949ab4153e2ed15ce59cd2946ab2db2dc
|
|
| MD5 |
b9617ec5eba97dbc4c03d2287fb0bc27
|
|
| BLAKE2b-256 |
ea8f97aa28283e441be19ccde07929216b0b7c679bf827425bc46c8bc5d820e9
|