Balance and visualize multi-cluster interaction networks
Project description
netbalance
netbalance is a Python library and CLI tool for balancing and visualizing multi-cluster interaction (association) networks.
Installation
pip install netbalance
Quick start
Balancing an interaction network using entity-balanced sampling:
cat data/virus-host.csv | netbalance --seed 0 --max-iter 1000
Balancing an interaction network using uniform random sampling with a 1:1 negative-to-positive ratio:
cat data/virus-host.csv | netbalance -m balanced --negative-ratio 1.0
Visualizing a bipartite network:
cat data/virus-host.csv | netbalance viz -o virus-host.png
Data format
All inputs are CSVs where the first N columns are entity names (one per cluster) and the last column is a binary label (1 = positive interaction, 0 = negative):
A,B,interaction
A1,B2,1
A1,B4,0
The viz subcommand requires exactly 2 entity columns (bipartite).
Python API
If you prefer to use the Python API instead of the CLI, see the example notebook.
Example usage
Balancing and visualizing a virus-host interaction network
The following cammand uses the entity-balanced sampling method to balance a virus-host interaction network, then visualizes the balanced network as a bipartite graph.
cat data/virus-host.csv | netbalance --seed 0 --max-iter 20000 --delta 0.001| netbalance viz -o virus-host.png
The resulting graph is shown below:
Entity-balanced sampling without the degree-ratio guided intialization
cat data/virus-host.csv | netbalance --seed 0 --max-iter 20000 --delta 0.001 --no-heuristic
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 netbalance-0.2.0.tar.gz.
File metadata
- Download URL: netbalance-0.2.0.tar.gz
- Upload date:
- Size: 3.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92ee002cb265d613fdd49243a7bc41c9e2806b6129d767be1da60d43b23d80bb
|
|
| MD5 |
fedcf574a09585c7833a2a22bf226a40
|
|
| BLAKE2b-256 |
6bafce153cadbf2ae4f641d832974e899141af6d0fb2f92b563b985dd00a8309
|
Provenance
The following attestation bundles were made for netbalance-0.2.0.tar.gz:
Publisher:
python-publish.yml on sobhanAhmadian/netbalance
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
netbalance-0.2.0.tar.gz -
Subject digest:
92ee002cb265d613fdd49243a7bc41c9e2806b6129d767be1da60d43b23d80bb - Sigstore transparency entry: 1629642205
- Sigstore integration time:
-
Permalink:
sobhanAhmadian/netbalance@c0829cb5b4945f4431a54bf54d127b635dac7f76 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/sobhanAhmadian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c0829cb5b4945f4431a54bf54d127b635dac7f76 -
Trigger Event:
release
-
Statement type:
File details
Details for the file netbalance-0.2.0-py3-none-any.whl.
File metadata
- Download URL: netbalance-0.2.0-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ec6838787f1164a3f9c1e00c8255f885ae75d16d22537106ec89ca1befe3659
|
|
| MD5 |
70e7c646c3d262213c84c719472bfda3
|
|
| BLAKE2b-256 |
1f1e438455d6075acae504e502cf0a6141da1b3e5f7cfe0a91e530542b11db80
|
Provenance
The following attestation bundles were made for netbalance-0.2.0-py3-none-any.whl:
Publisher:
python-publish.yml on sobhanAhmadian/netbalance
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
netbalance-0.2.0-py3-none-any.whl -
Subject digest:
9ec6838787f1164a3f9c1e00c8255f885ae75d16d22537106ec89ca1befe3659 - Sigstore transparency entry: 1629642235
- Sigstore integration time:
-
Permalink:
sobhanAhmadian/netbalance@c0829cb5b4945f4431a54bf54d127b635dac7f76 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/sobhanAhmadian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c0829cb5b4945f4431a54bf54d127b635dac7f76 -
Trigger Event:
release
-
Statement type: