NWNet
Small-world network based orthogroup inference.
NWNet infers orthogroups from protein FASTA files (one file per genome) through a four-stage pipeline. To avoid the quadratic cost of all-against-all sequence comparison, NWNet builds a Newman–Watts small-world graph over the input genomes and aligns proteins only along the edges of this graph; a graph-based network-optimisation step then recovers orthologs that the sparse initial alignment would otherwise miss.
Key features
- Small-world sparsification — at the default neighbourhood size (k = n/4), NWNet removes roughly 70% of the genome-pair comparisons while keeping the genome graph connected and every genome sampled at least k times.
- Four network filters — reciprocal best hit (RBH), a fixed cutoff, and graph-based refinement with a median/MAD fallback (GBR, GBR_MAD).
- Adaptive Markov clustering — global MCL or adaptive MCL with a per-component inflation interpolated from the copy-number ratio (proteins per covered genome).
- Main-tier accuracy — on the Quest for Orthologs 2022 benchmark, NWNet reaches precision comparable to scalability-oriented methods such as FastOMA.
Installation
NWNet requires Python ≥ 3.10. Install from source:
git clone https://github.com/MSE-Lab/NWNet.git
cd NWNet
pip install .
The Python dependencies are installed automatically; the external alignment, clustering and
phylogenetics tools listed below must be installed separately and be on PATH.
For development (editable install with test dependencies):
pip install -e ".[dev]"
pytest
Dependencies
Python libraries (installed automatically by pip)
| Library | Minimum version | Purpose |
|---|---|---|
igraph |
0.11 | Graph construction, connected components, and network representation |
numpy |
1.24 | Numerical computation |
matplotlib |
3.7 | Plotting |
External tools (install separately; must be on PATH)
| Tool | Required for | Purpose |
|---|---|---|
| DIAMOND | nwnet run |
Protein alignment (default backend) |
NCBI BLAST+ (blastp) |
nwnet run |
Optional alternative backend (--align-method blastp) |
| MCL | nwnet run |
Graph clustering |
| MAFFT | nwnet phylo |
Single-gene alignment |
| trimAl | nwnet phylo |
Alignment trimming |
| FastTree | nwnet phylo |
Tree inference |
Quick start
nwnet run \
--input-dir /path/to/protein_fastas \
--output-dir /path/to/result \
--threads 32
The input is a directory of protein FASTA files, one per genome. The orthogroups are written to result/Orthogroups/Orthogroups.txt.
Usage
NWNet provides four subcommands:
nwnet run— the full orthology pipeline (small-world network → alignment → network optimisation → clustering → orthogroup output).nwnet compare— evaluate the agreement between two orthogroup sets (adjusted Rand index, adjusted/normalised mutual information, Fowlkes–Mallows index, V-measure, and split/merge statistics).nwnet pan— pangenome analysis: classify orthogroups into core/softcore/shell/cloud, fit the pangenome accumulation curve (Heaps' law), and produce visualisations.nwnet phylo— build a supermatrix species tree from single-copy core orthogroups (MAFFT + trimAl + FastTree).
Key options for nwnet run:
--network-method {RBH,cutoff,GBR,GBR_MAD} base network filter (default: RBH)
--weighting {identity,bitscore,evalue,normbitscore}
edge weighting (default: normbitscore)
--k n neighbourhood size (default: n/4)
--p p random long-range edge probability (default: 0.2)
--mcl-mode {global,adaptive} clustering mode (default: adaptive)
--inflation i MCL inflation (default: 1.2)
Run nwnet run --help for the complete list of options.
Documentation
nwnet runuser guide — the orthology inference pipelinenwnet compareuser guide — compare two orthogroup setsnwnet panuser guide — pangenome analysisnwnet phylouser guide — species-tree reconstruction
The guides are also shipped inside the source distribution under docs/.
The release history is in CHANGELOG.md.
Citation
The NWNet manuscript is in preparation. Until it appears, please cite the software itself:
Lu Y-F, Zhi X-Y. NWNet: small-world network based orthogroup inference. Version 0.1.0. https://github.com/MSE-Lab/NWNet
This entry will be replaced by the paper upon publication.
License
NWNet is licensed under the GNU General Public License v3 (GPL-3.0-or-later). See LICENSE.
Contact: Xiao-Yang Zhi (xyzhi@ynu.edu.cn).
Metadata
Release files for nwnet 0.1.0
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 |
|---|---|---|---|---|
| nwnet-0.1.0.tar.gz | 186.4 kB | Without provenance | Details for nwnet-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nwnet-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for nwnet-0.1.0-py3-none-any.whl |
Total release size: 334.1 kB
Release files / nwnet-0.1.0.tar.gz
| Download URL | nwnet-0.1.0.tar.gz |
|---|---|
| Size | 186.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac9c054628be145f61102523311e9b54044ade5fcea21be8ab656d17f0c24b33
|
|
BLAKE2b-256 checksum How to use checksums |
36736b31b1a1d1c0b4b4edc804481707d4ec512737d6b5b780161c4c449146cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.3
|
Release files / nwnet-0.1.0-py3-none-any.whl
| Download URL | nwnet-0.1.0-py3-none-any.whl |
|---|---|
| Size | 147.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
33ab49e5e390460c1397ef9e99ab16d6242ebc9afc5548a29eb86cd95a54885e
|
|
BLAKE2b-256 checksum How to use checksums |
29b21bece61950a8a475ff30a8297e9719e51117c6399e4e208ad29149f829b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.3
|
Security for nwnet 0.1.0
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.