Network builder for multi-omics matrices.
Project description
netan
netan is a network analysis library for omics data. It builds sample or feature graphs from one or more matrices, tunes graph construction, ranks features against sample labels, and exports publication-ready or Cytoscape-ready outputs.
It works naturally with rodin and Rodin-like objects.
Web app: netan.io
Highlights
- Build graphs in
samplesorfeaturesmode. - Work with single-omics or multilayer multi-omics data.
- Use
spearman,clr,rf, orglassoinference. - Tune graph construction with a reusable
grid -> scores_grid -> materializeworkflow. - Rank features with graph-aware label separation statistics.
- Visualize interactively with Plotly and export edge tables directly.
Installation
pip install netan
Requires Python >=3.10.
Quick start
import rodin
import netan
r1 = rodin.create("metabolomics.csv", "meta.csv")
r2 = rodin.create("transcriptomics.csv", "meta.csv")
r1.transform()
r2.transform()
nt = netan.create([r1, r2])
nt.build(
method="spearman",
node_mode="samples",
layer_mode="multilayer",
)
nt.plot(color="Group", title="Sample network")
Core workflow
Build
nt.build(
method="rf",
node_mode="samples",
layer_mode="multilayer",
k="auto",
)
If you do not pass thresholds, netan sparsifies automatically through auto_target.
Inspect
nt.info()
nt.params()
nt.scores()
nt.edges()
Tune
nt.tune(label="Group")
nt.best()
For repeated score iteration on the same candidate space:
nt.grid()
nt.scores_grid(
label="Group",
weights={
"sep": [15, 5, 80],
"supervised": [60, 15, 15, 10],
},
)
nt.materialize()
Rank and shortlist
nt.rank("Group")
nt.stability_rank("Group")
nt_small = nt.shortlist(p_adj_max=0.01)
This workflow is available in samples mode and is useful when you want graph-aware feature selection before rebuilding a smaller network.
Concepts
Node mode
samples: nodes are samples and edges represent sample similarityfeatures: nodes are features and multilayer builds can include cross-omics feature edges
Layer mode
stack: one combined graphmultilayer: per-layer graphs plus integrated outputs
Methods
spearman: correlation-basedclr: mutual-information basedrf: ExtraTrees similarityglasso: sparse precision graph
Sparsity controls
auto_target: default thresholding controlk=None: threshold-only graphk="auto": adaptive kNN pruningmutual=True: stricter kNN graphattach_isolates=True: reconnect isolates after sparsification
Tuning model
tune() separates expensive candidate construction from cheap rescoring:
grid(): build all candidate graph states oncescores_grid(): score the grid in unsupervised or supervised modematerialize(): restore any leaderboard row as a liveNetanobject
This makes it practical to iterate on score weights without rerunning inference.
Visualization and export
nt.plot(layout="kamada_kawai", color="Group")
nt.export("edges.csv")
Supported layouts:
force-directedspringcircularkamada_kawairandom
Persistence
path = nt.save("netan.pkl")
nt2 = netan.load(path)
This restores stored graphs, rankings, caches, and tuning grids. The live Plotly figure handle is not serialized.
Input contract
netan expects one object or a list of objects exposing:
r.X:pandas.DataFramewith shapefeatures x samplesr.samples:pandas.DataFramewhose first column contains sample IDs aligned tor.X.columnsr.features: optional feature metadata
Rodin already matches this layout.
Public API
Main entry points:
netan.create(...)netan.load(path)Netan.build(...)Netan.adjust(...)Netan.grid(...)Netan.scores_grid(...)Netan.materialize(...)Netan.tune(...)Netan.rank(...)Netan.stability_rank(...)Netan.shortlist(...)Netan.plot(...)Netan.export(...)Netan.save(path)
For exact parameters, use the Python docstrings.
Notes
samplesmode is where label-aware tuning andrank()make the most sense.featuresmode is the right choice for variable-level network exploration.- For larger graphs,
spearman,clr, andrfare usually the practical defaults.
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 netan-2.1.3.tar.gz.
File metadata
- Download URL: netan-2.1.3.tar.gz
- Upload date:
- Size: 69.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81b7acff111d6fc54423787528419a41ac5479795ac51e726d45b954f8e7f74e
|
|
| MD5 |
96692e88c58eb1928ccb6cedadf27f6b
|
|
| BLAKE2b-256 |
66b6285e8bfa93a9a4349cd7a36459fd8c5286f1f8f060aa2232b44da2b0a22d
|
File details
Details for the file netan-2.1.3-py3-none-any.whl.
File metadata
- Download URL: netan-2.1.3-py3-none-any.whl
- Upload date:
- Size: 70.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a284a2da8ffa2c513874aa79998764916d3bedc174354fedcb7fc918db3d0797
|
|
| MD5 |
980f814e2b7b7c6e44fa6ad312a93d97
|
|
| BLAKE2b-256 |
925608ae8bc40f7e46cc61de9049b2491728f152f1ef36cb2f3c2013bca7aa80
|