WNetAlign
WNetAlign is a tool for MS (Mass Spectrometry) or NMR (Nuclear Magnetic Resonance) spectral alignment using Truncated Wasserstein Metric-based methods. It offers algorithms and utilities for comparing and mapping spectral features between datasets, leveraging advanced optimal transport techniques and spectral topology.
Features
- Truncated Wasserstein metric-based spectral alignment
- Algorithms for spectral feature comparison and mapping
- Utilities for preprocessing and visualization
Installation
pip install wnetalign
Usage
import numpy as np
from wnetalign import Spectrum, WNetAligner
from wnet.distances import DistanceMetric
# positions shape: (dim, num_peaks); intensities shape: (num_peaks,)
S1 = Spectrum(positions=np.array([[1.0, 2.5, 4.0]]), intensities=np.array([1.0, 3.0, 2.0]))
S2 = Spectrum(positions=np.array([[1.1, 2.4, 4.2]]), intensities=np.array([1.0, 2.5, 2.5]))
S1 = S1.normalized()
S2 = S2.normalized()
aligner = WNetAligner(
empirical_spectrum=S1,
theoretical_spectra=[S2],
distance=DistanceMetric.L2,
max_distance=0.5,
trash_cost=0.9,
)
aligner.set_point([1])
print("Total cost:", aligner.total_cost())
flows = aligner.flows()[0] # Flow(empirical_peak_idx, theoretical_peak_idx, flow)
emp_ids, theo_ids = aligner.consensus() # greedy 1-to-1 pairs
For more complete examples see the tutorials directory.
Tutorials
Tutorials showing how to apply wnetalign to NMR data can be found in tutorials/nmr, while an example of LC-MS alignment can be found in tutorials/lcms.
Results from publication
To reproduce the results and figures from the paper "WNetAlign: Fast and Accurate Spectra Alignment Using Truncated Wasserstein Distance and Network Simplex" use the scripts and notebooks provided in the publication/nmr folder for NMR data; for an LC-MS alignment example see tutorials/lcms.
2D NMR data
The 2D 15N-1H HSQC spectra are available in publication/nmr/2D/15N_HSQC_GB1_reduced folder.
NMR_2D_original.ipynb- plotting data distribution, chain alignment of the series of 15N-1H HSQC spectra measured in different temperaturesNMR_2D_simulated.ipynb- simulating synthetic temperature series, validation of alignment procedure using standard and extended metrics, heatmapsNMR_2D_seeds.ipynb- performing alignments for the synthetic temperature series with different random seeds
4D NMR data
The 4D CCNOESY spectrum of 2LX7 pdb structure can be found in the publication/nmr/4D/2LX7.
NMR_4D.ipynb- simulating the replicate of the 4D 2LX7 CCNOESY spectrum and validating the alignment between the original spectrum and the replicate with standard and extended performance metrics
7D NMR data
The hypothetical 7D NMR spectra can be found in publication/nmr/7D/NMR_7D.
NMR_7D.ipynb- simulating the replicates of the 17 hypothetical 7D NMR spectra and validating the alignments between the original hypothetical spectra and the replicates with extended performance metrics
Citation
If you use this software, please cite:
Król J, Bochenek M, Jopa S, Kazimierczuk K, Gambin A, Startek MP (2026). WNetAlign: fast and accurate spectra alignment using truncated Wasserstein distance and network simplex. Briefings in Bioinformatics, 27(3), bbag247. https://doi.org/10.1093/bib/bbag247
@article{krol2026wnetalign,
title = {WNetAlign: fast and accurate spectra alignment using truncated Wasserstein distance and network simplex},
author = {Kr{\'o}l, Justyna and Bochenek, Maria and Jopa, Sylwia and Kazimierczuk, Krzysztof and Gambin, Anna and Startek, Micha{\l} Piotr},
journal = {Briefings in Bioinformatics},
volume = {27},
number = {3},
pages = {bbag247},
year = {2026},
doi = {10.1093/bib/bbag247}
}
License
This project is licensed under the MIT License.
Metadata
Release files for wnetalign 1.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 | |
|---|---|---|---|
| wnetalign-1.1.0.tar.gz | 21.6 kB | Details |
Built distributions (wheels)
Total release size: 4.7 MB
Release files / wnetalign-1.1.0.tar.gz
| Download URL | wnetalign-1.1.0.tar.gz |
|---|---|
| Size | 21.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
16cf76c562fb5a9ed51811fadee9cd19f8bfad421ab590ea83f7aa45ba06575c
|
|
BLAKE2b-256 checksum How to use checksums |
3d98f05cbd8bb4af1b57bf0370aab229aa2dd0426e03a3e6923a74e5c1cf3fc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency logRelease files / wnetalign-1.1.0-cp315-abi3t-win_arm64.whl
| Download URL | wnetalign-1.1.0-cp315-abi3t-win_arm64.whl |
|---|---|
| Size | 611.3 kB |
| Tags | CPython 3.15 Windows ARM64 abi3t |
|
SHA-256 checksum How to use checksums |
f098a7e8d919450af6228532b2cd6d1e12af119dab08940a956bc90ebc7d12ef
|
|
BLAKE2b-256 checksum How to use checksums |
4801fc548f97eefdc4fd9ad346c295be355419c8f3a7ed004a102ee39e8a0ee6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency logRelease files / wnetalign-1.1.0-cp315-abi3t-win_amd64.whl
| Download URL | wnetalign-1.1.0-cp315-abi3t-win_amd64.whl |
|---|---|
| Size | 464.6 kB |
| Tags | CPython 3.15 Windows x86-64 abi3t |
|
SHA-256 checksum How to use checksums |
0e161001d64d332885cefd9d5eb92c037812f5fcb535b459cc753604381b4009
|
|
BLAKE2b-256 checksum How to use checksums |
bc16fe2794e9910e81174892bc26ecb32166ba13facfbe781a2ef466143e991a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency logRelease files / wnetalign-1.1.0-cp315-abi3t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | wnetalign-1.1.0-cp315-abi3t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 359.2 kB |
| Tags | CPython 3.15 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 abi3t |
|
SHA-256 checksum How to use checksums |
837ec9d5163ef65ea3808dd173a0fb9aa6c64524c78f7860c629cf4d8d5e364a
|
|
BLAKE2b-256 checksum How to use checksums |
cf7d2c2729895d4455a4db3392fb37c0b560bc517937a4433cb71299e18f0eb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency logRelease files / wnetalign-1.1.0-cp315-abi3t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | wnetalign-1.1.0-cp315-abi3t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 322.5 kB |
| Tags | CPython 3.15 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 abi3t |
|
SHA-256 checksum How to use checksums |
fe43cdbd6e40893df328ebf414ca41f37600a30dd94dc37018630beff32c2a6e
|
|
BLAKE2b-256 checksum How to use checksums |
b5c4de9b77c3021dce8176136d97590f08e9983d39342363ce6d79cacac10062
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency logRelease files / wnetalign-1.1.0-cp315-abi3t-macosx_11_0_arm64.whl
| Download URL | wnetalign-1.1.0-cp315-abi3t-macosx_11_0_arm64.whl |
|---|---|
| Size | 280.4 kB |
| Tags | CPython 3.15 abi3t macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
bcc7498df30a591e00436bc89ed37eadb176d41e80f164c56b880e9a99832c28
|
|
BLAKE2b-256 checksum How to use checksums |
b551da29f4c216c89cbe78f8ae8c83826c48d8ca69c506249ddb282d4f95d706
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency logRelease files / wnetalign-1.1.0-cp315-abi3t-macosx_10_15_x86_64.whl
| Download URL | wnetalign-1.1.0-cp315-abi3t-macosx_10_15_x86_64.whl |
|---|---|
| Size | 316.4 kB |
| Tags | CPython 3.15 abi3t macOS 10.15+ x86-64 |
|
SHA-256 checksum How to use checksums |
1c19090ee0c48e0c2acdddb506b5a96732c03d3847540c47ed34981fecb26534
|
|
BLAKE2b-256 checksum How to use checksums |
9752f9753e4697bbae2d2dcce89c01a3444ec6ea92cb3e498a9d9115610cd5af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency logRelease files / wnetalign-1.1.0-cp310-abi3-win_arm64.whl
| Download URL | wnetalign-1.1.0-cp310-abi3-win_arm64.whl |
|---|---|
| Size | 590.6 kB |
| Tags | CPython 3.10 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
b1ac52e5ab68a0e2339299d003e2f7da6715986d2e5959de4f58aa85f77676ec
|
|
BLAKE2b-256 checksum How to use checksums |
687b8cdb03c98e001f08008328d8e4eecd49b1a83326f3bd2ea536562e1920b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency logRelease files / wnetalign-1.1.0-cp310-abi3-win_amd64.whl
| Download URL | wnetalign-1.1.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 450.2 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
5b5b5d049f31b15874594f92a78ed87b7d45711bd898ce9e05f33a5daed4e2b3
|
|
BLAKE2b-256 checksum How to use checksums |
71edfc956e069a4cb4878794f548c17c947f7dca6d0c3cee5277f348690c2269
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency logRelease files / wnetalign-1.1.0-cp310-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | wnetalign-1.1.0-cp310-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 358.1 kB |
| Tags | CPython 3.10 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d3968461505b3df3881558639e809f8675b95dbb0ceffc1d9d4d8dd514836b87
|
|
BLAKE2b-256 checksum How to use checksums |
099e9da2a9b50c5d8b306c8433c9d5898e84feab08e7a0ae0306135c5ed38694
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency logRelease files / wnetalign-1.1.0-cp310-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | wnetalign-1.1.0-cp310-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 321.8 kB |
| Tags | CPython 3.10 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
ded6beac7d44f5995323beec863da27a04bffba9ae4bc219e132a34f5820ed3d
|
|
BLAKE2b-256 checksum How to use checksums |
71ca788067a4a06c09ba6ab93765e74478752017a29baf0d5fd4bfd8d4c99089
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency logRelease files / wnetalign-1.1.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | wnetalign-1.1.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 280.0 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
64f400364e588032a1b0531fdc75ebbb49e003c7a669c743a27fa0cdcddb690d
|
|
BLAKE2b-256 checksum How to use checksums |
c29527f3058395abe39b3537c00964efb2709b3f18047a9c37e092005365ec93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency logRelease files / wnetalign-1.1.0-cp310-abi3-macosx_10_15_x86_64.whl
| Download URL | wnetalign-1.1.0-cp310-abi3-macosx_10_15_x86_64.whl |
|---|---|
| Size | 315.7 kB |
| Tags | CPython 3.10 abi3 macOS 10.15+ x86-64 |
|
SHA-256 checksum How to use checksums |
43912c935707175ceed4c5e09b550abf73f3d3c5ca5f2d5187c6751fd91451c8
|
|
BLAKE2b-256 checksum How to use checksums |
7f41826ec029045db9fe4dabc3b0181ea9c8d05993d52824e9eca38f48505ed3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency log