Skip to main content

Fast NeighbourNet (Rust) with Python bindings

Project description

DOI

fast-nnt

fast-nnt (read Fast Ent) is a simple Rust implementation of the Neighbour Net algorithm with both R and Python bindings.

Introduction

Fast-NNT is a Rust implementation of the NeighbourNet algorithm, designed for efficient phylogenetic analysis. It constructs split trees from distance matrices, providing a fast and reliable tool for researchers in evolutionary biology. R and Python bindings are provided so that users can easily integrate Fast-NNT into their existing workflows.

Why does this exist when SplitsTree is available?

Well, SplitsTree4/6 are GUI-based applications, while Fast-NNT is a command-line tool that can be easily integrated into automated workflows and pipelines. It's meant to be lightweight and simple to use, you provide a simple input and it generates the nexus file. You can then use this file in R or Python to generate your own plots. This is perfect for people who love to manually beautify their visualizations.

Additionally, we provide R and Python bindings that allow you pass in memory data matrices directly with a single command and get results without having to write intermediate files. For installation instructions, please refer to the respective documentation for R and Python.

How do the results compare to SplitsTree?

Fast-NNT aims to produce results that are consistent with those generated by SplitsTree, but there may be differences due to the underlying implementations and algorithms used. Users are encouraged to compare the output from Fast-NNT with that of SplitsTree to assess any discrepancies and determine the best tool for their specific needs.

Comparison to SplitsTree4

Installation

Install Rust via rustup.

Python

You can install the Python package via pip:

pip install fastnntpy

R

You can install the R package via:

install.packages("fastnntr")

# Or if CRAN is unavailable and you have Rust on your machine, i think this will work
devtools::install_github("rhysnewell/fast-nnt", subdir = "fastnntr")

If you are developing locally and have changed the R bindings:

rextendr::document()
devtools::load_all()

CLI

cargo install fast-nnt

Alternatively, you can build from source. Clone and install this repo via:

git clone https://github.com/rhysnewell/fast-nnt.git
cd fast-nnt
cargo install --path .

Usage

For Python and R, complete usage examples can be found in test/python and test/R. But a brief summary is as follows.

Python

Read data in via numpy, pandas, or polars:

import fastnntpy as fn
import pandas as pd
data = pd.read_csv("test/data/large/large_dist_matrix.csv")
n = fn.run_neighbour_net(data)
print("Labels")
print(len(n.get_labels()))
print("Splits Records")
print(len(n.get_splits_records()))
print("Node Translations")
print(len(n.get_node_translations()))
print("Node Positions")
print(len(n.get_node_positions()))
print("Graph Edges")
print(len(n.get_graph_edges()))

R

Read your distance matrix in using your preferred method (e.g., data.table):

library(fastnntr)
library(data.table)
data <- fread("test/data/large/large_dist_matrix.csv", header=TRUE)
# Load network
Nnet <- fastnntr::run_neighbournet_networkx(data)

The run_neighbournet_networkx function will return an object almost identical to that produced by phangorn, so should be compatible with existing workflows.

CLI

Required input is a symmetrical distance matrix, ideally with a header row indicating the taxa labels. Can be separated by any delimiter.

To generate a split nexus file (mostly) identical to SplitsTree4 and SplitsTree6:

fast_nnt neighbour_net -t 4 -i test/data/large_dist_matrix.csv -d output_dir -o prefix -O splits-tree4

Use the new Huson 2023 ordering algorithm (default):

fast_nnt neighbour_net -t 4 -i test/data/large_dist_matrix.csv -d output_dir -o prefix -O huson2023

Output

The output will include a nexus file containing the split network and network layout.

Citations

If you use this tool in your work, please cite the original authors work:

  • Bryant & Huson 2023: D. Bryant and DH Huson, NeighborNet- improved algorithms and implementation. Front. Bioinform. 3, 2023.
  • Bryant & Moulton 2004: D. Bryant and V. Moulton. Neighbor-net: An agglomerative method for the construction of phylogenetic networks. Molecular Biology and Evolution, 21(2):255– 265, 2004.

You can also cite this repository directly:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fastnntpy-0.2.3-cp313-cp313-win_amd64.whl (393.1 kB view details)

Uploaded CPython 3.13Windows x86-64

fastnntpy-0.2.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (648.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

fastnntpy-0.2.3-cp313-cp313-macosx_11_0_arm64.whl (516.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

fastnntpy-0.2.3-cp312-cp312-win_amd64.whl (393.2 kB view details)

Uploaded CPython 3.12Windows x86-64

fastnntpy-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (648.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

fastnntpy-0.2.3-cp312-cp312-macosx_11_0_arm64.whl (516.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

fastnntpy-0.2.3-cp311-cp311-win_amd64.whl (393.0 kB view details)

Uploaded CPython 3.11Windows x86-64

fastnntpy-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (649.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

fastnntpy-0.2.3-cp311-cp311-macosx_11_0_arm64.whl (517.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

fastnntpy-0.2.3-cp310-cp310-win_amd64.whl (393.2 kB view details)

Uploaded CPython 3.10Windows x86-64

fastnntpy-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (649.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

fastnntpy-0.2.3-cp310-cp310-macosx_11_0_arm64.whl (517.7 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

fastnntpy-0.2.3-cp39-cp39-win_amd64.whl (394.1 kB view details)

Uploaded CPython 3.9Windows x86-64

fastnntpy-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (649.1 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

fastnntpy-0.2.3-cp39-cp39-macosx_11_0_arm64.whl (518.0 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

fastnntpy-0.2.3-cp38-cp38-win_amd64.whl (393.5 kB view details)

Uploaded CPython 3.8Windows x86-64

fastnntpy-0.2.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (649.2 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

fastnntpy-0.2.3-cp38-cp38-macosx_11_0_arm64.whl (518.0 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

File details

Details for the file fastnntpy-0.2.3-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: fastnntpy-0.2.3-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 393.1 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for fastnntpy-0.2.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 694bb0cf102b712399194145148d13c2e0e3118efe2393cfe43f42d2f4c35f47
MD5 b298b6d2f0ed34741f2a10179d754f42
BLAKE2b-256 c1ae3dbbe42ac8e266f0b477c14b3dc3899f72ced8826f0d7f27f987cb7e569e

See more details on using hashes here.

File details

Details for the file fastnntpy-0.2.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastnntpy-0.2.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9f2dcf7fc85ad4805e638059be55f49e2b9d3290fad5efd4cebe14cd87c7496e
MD5 79b80d30a1c22fc76f5ff792ea1077d2
BLAKE2b-256 aaa4ea7b88f2f2947ed471113d937f980b6d0ec597d1a0f0b349a84e3ae6605c

See more details on using hashes here.

File details

Details for the file fastnntpy-0.2.3-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastnntpy-0.2.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fc9d43ed8e481786ad34aaaa476fbe4d3936458f6f9a314126650b699915ad5c
MD5 dbee3e16f8220f6cb78be3d3a465ba9f
BLAKE2b-256 7cc0ae262d2e73d0e9313517d5a6625d13c0a76c9767881851f9799416cbcbe6

See more details on using hashes here.

File details

Details for the file fastnntpy-0.2.3-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: fastnntpy-0.2.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 393.2 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for fastnntpy-0.2.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2461ad6fe74e94b2ce9142da114087aefdf8e80d6d22c5b41c035966c3d98b9d
MD5 9b7e2811efbb3c76684300b85769f144
BLAKE2b-256 1431c2dfeb288df213dbd4574db2ab9aadb625ef708de3331a9503885e70aaf3

See more details on using hashes here.

File details

Details for the file fastnntpy-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastnntpy-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 385b97d064a0fe76303a0160811778fd6328dd8a9daa5c987bc208712702267b
MD5 cad4d6cd33ba54311c724abea70264fb
BLAKE2b-256 1973496d2066fd7f328372b6a52b26d60b9176c4f4d434ecd55176dd7b9f7502

See more details on using hashes here.

File details

Details for the file fastnntpy-0.2.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastnntpy-0.2.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b254d69e8669f4742aa911b206f78ff7dd9cbd020d3f43f8a96546466283133e
MD5 fc5bd44874cdfdaeab2e38dbbff7490c
BLAKE2b-256 cae8e4809c2974eb324c32fd02877fed6ed0f022e46e4b13fb5b095fe7cc50f2

See more details on using hashes here.

File details

Details for the file fastnntpy-0.2.3-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: fastnntpy-0.2.3-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 393.0 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for fastnntpy-0.2.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ead4e5e16de9f19b08e11e963d5ea376b260b9d5f4b8a0c3cc1d768c7c901823
MD5 d953e2d8c3e932abd39e62ea2c2d2dfe
BLAKE2b-256 0fa7084ca446c4a3799464e7106de6fd90e331bb80893524d143b5a84bf2abd2

See more details on using hashes here.

File details

Details for the file fastnntpy-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastnntpy-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 52824c2fd2e05ba70d625e7467c235a49c2c9cbfcf4ad9125669a7f300312015
MD5 3d0e45ca89aed7711d591f2e4fa75ff5
BLAKE2b-256 9745655dc97332470a7ec47a38b9d45eb0238df7de6cac13662fc11fe256a978

See more details on using hashes here.

File details

Details for the file fastnntpy-0.2.3-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastnntpy-0.2.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 44f1277b03f3fde3a8d99abb0701899b2b025fbacc2fe8117edb35084eece8a5
MD5 ea8bc3b977df460334feb2e92bb89344
BLAKE2b-256 0a64bb6b932c1363edc9074783041f53911d41efdef9145305c2efd3d245b4f9

See more details on using hashes here.

File details

Details for the file fastnntpy-0.2.3-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: fastnntpy-0.2.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 393.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for fastnntpy-0.2.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 109cbae661c637c9d01041602277f97b192781dc905e1793af8331ed92a03904
MD5 a26d43de25a4a906b6d16bcc0bd62cca
BLAKE2b-256 f13b7f460c9d42c1f1dbe58e24c3bc6672e498ad9941f16f10e8aa7bc30efb01

See more details on using hashes here.

File details

Details for the file fastnntpy-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastnntpy-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c2857a4b04af960176545f7ce15f5841c59d9dff744a9d69e01fb7dc9da3f0ff
MD5 a51b4188624827594a99738eee258655
BLAKE2b-256 fdb6b5207b6bd6cf9e37128c4b2a135861580d8cfb4fd27ac1094b73a9e18a19

See more details on using hashes here.

File details

Details for the file fastnntpy-0.2.3-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastnntpy-0.2.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d000564e69fc2367344f78dc7cb2bf3bc012325580e6428a1ee832f61b9b10f4
MD5 77dd1d7bca0c148eb07d64a9be4d01d6
BLAKE2b-256 371459b551bb8cea63ff249cb01b29ad42e8a811e45cf3695472fd876f4c79ea

See more details on using hashes here.

File details

Details for the file fastnntpy-0.2.3-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: fastnntpy-0.2.3-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 394.1 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for fastnntpy-0.2.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 8e39b61e497c55189431788906d6112ea7f6c91b835a57f41be96735b39185a5
MD5 ab810f9df05407df5ff4fb98ed28ec8b
BLAKE2b-256 69c4df8fdcfe5a225cdec6bf8aa1f12d9bd6bdb23aa157789d680296ebd7f7ef

See more details on using hashes here.

File details

Details for the file fastnntpy-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastnntpy-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2622ae8121cffbc8ef1d408cf786433c0ffc4038c7f014bda8739fd809b25462
MD5 2e467fbbd8e44bf5295132fb583155cb
BLAKE2b-256 3c2dc05580d3dadc6376a2741dc5007fc4d6250f6c1d5752b9aeae8cf287141d

See more details on using hashes here.

File details

Details for the file fastnntpy-0.2.3-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastnntpy-0.2.3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 392ffeb9f408cde4f4cf12cb329ed645a7adf31401ddaea8fcd8363633e98136
MD5 1ab46b196aed8dd3e31c740f555b677c
BLAKE2b-256 3470ec187ba7da7d0e8f8c0542263bd93829c53b2245ecc9a39b878c145d29b6

See more details on using hashes here.

File details

Details for the file fastnntpy-0.2.3-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: fastnntpy-0.2.3-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 393.5 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for fastnntpy-0.2.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 be692d63c165d291f7206d049f333e1db6fc5d8d67db075d35ec96a30d1fadbf
MD5 c5b8b864d1a22da4d860492edc8446c3
BLAKE2b-256 0a212c5bf6f58bd8288c91c53f7037e8ccec69ff930f59a2577d1773961b305f

See more details on using hashes here.

File details

Details for the file fastnntpy-0.2.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastnntpy-0.2.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b2e53a5f37e28d3d9adfb6a98f4cfc9ea344d60ee5ed1060711571f9ea88054e
MD5 47dd67713f33fe407c2c91adb5f5c85a
BLAKE2b-256 74e2c4e590063b291fb9f78f894f55ce6d6b7faf12819927fabfc621dfa4eed0

See more details on using hashes here.

File details

Details for the file fastnntpy-0.2.3-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastnntpy-0.2.3-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 55645f85f4baccf52764a9acf956ad378f95402caaeb4d9df1782a9d9ecca077
MD5 6c2f4b81849148ddb9cefdbce5becc57
BLAKE2b-256 d078ea675e1efc589c95ca0369fad67f85a1be68905d851842ea93e78f4e9065

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page