Skip to main content

Neighbor-Joining phylogenetic tree inference. Auto-detects DNA/protein, supports multiple substitution models and bootstrap.

Project description

nj.rs

Neighbor-Joining phylogenetic tree inference in Rust, with Python and WASM bindings.

Release Tests

Crates.io Version PyPI - Version NPM Version

Takes an aligned FASTA file as input and outputs a Newick string. Alphabet (DNA/protein) is auto-detected. Supports optional bootstrap support values on internal nodes.

Substitution models: PDiff (DNA + protein), JukesCantor (DNA), Kimura2P (DNA), Poisson (protein)

CLI

cargo install nj --features cli

nj sequences.fasta
nj --substitution-model kimura2-p --n-bootstrap-samples 100 sequences.fasta > tree.nwk

A progress bar is shown on stderr when bootstrapping.

Rust

[dependencies]
nj = "0.0.12"
use nj::{NJConfig, SequenceObject, nj, models::SubstitutionModel};

let newick = nj(NJConfig {
    msa: vec![
        SequenceObject { identifier: "A".into(), sequence: "ACGT".into() },
        SequenceObject { identifier: "B".into(), sequence: "ACCT".into() },
    ],
    n_bootstrap_samples: 100,
    substitution_model: SubstitutionModel::JukesCantor,
}, Some(Box::new(|current, total| println!("{current}/{total}"))))?;

Python

pip install nj_py
from tqdm import tqdm
from nj_py import nj

msa = [
    {"identifier": "A", "sequence": "ACGT"},
    {"identifier": "B", "sequence": "ACCT"},
]

with tqdm(total=100) as bar:
    newick = nj(
        msa,
        substitution_model="JukesCantor",
        n_bootstrap_samples=100,
        on_progress=lambda current, total: bar.update(1),
    )

JavaScript / WASM

npm install @holmrenser/nj
import { nj } from '@holmrenser/nj';

const config = {
    msa: [
        { identifier: 'A', sequence: 'ACGT' },
        { identifier: 'B', sequence: 'ACCT' },
    ],
    n_bootstrap_samples: 100,
    substitution_model: 'JukesCantor',
};

const newick = nj(config, (current, total) => {
    progressBar.value = current / total * 100;
});

Project details


Download files

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

Source Distribution

nj_py-0.0.18.tar.gz (47.7 kB view details)

Uploaded Source

Built Distributions

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

nj_py-0.0.18-cp312-cp312-win_amd64.whl (180.9 kB view details)

Uploaded CPython 3.12Windows x86-64

nj_py-0.0.18-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (301.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

nj_py-0.0.18-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (297.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

nj_py-0.0.18-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (559.1 kB view details)

Uploaded CPython 3.12macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

nj_py-0.0.18-cp311-cp311-win_amd64.whl (182.9 kB view details)

Uploaded CPython 3.11Windows x86-64

nj_py-0.0.18-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (301.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

nj_py-0.0.18-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (298.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

nj_py-0.0.18-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (560.7 kB view details)

Uploaded CPython 3.11macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

nj_py-0.0.18-cp310-cp310-win_amd64.whl (182.6 kB view details)

Uploaded CPython 3.10Windows x86-64

nj_py-0.0.18-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (302.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

nj_py-0.0.18-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (298.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

nj_py-0.0.18-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (559.3 kB view details)

Uploaded CPython 3.10macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file nj_py-0.0.18.tar.gz.

File metadata

  • Download URL: nj_py-0.0.18.tar.gz
  • Upload date:
  • Size: 47.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nj_py-0.0.18.tar.gz
Algorithm Hash digest
SHA256 6e5d2f093f4d55722ac9f186cc677f6889de807de60121c0a243ebae91086f9c
MD5 01f3583e1b7211a3cfff8dedffddb44b
BLAKE2b-256 0bb774bf2152bb9632d20bc5c1d228ebcde7e8a33dfd97c3f859f0bcdb000fcc

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.18.tar.gz:

Publisher: release.yml on holmrenser/nj.rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nj_py-0.0.18-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: nj_py-0.0.18-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 180.9 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nj_py-0.0.18-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 13e669e08c770c2f8c91bd5bea8987a3b44efcd55af78787439bc7e5552d03c2
MD5 eefffb1bd5c633a3bff6edd5a44b5a62
BLAKE2b-256 a486987c6f9cd0af69960dce5d97f2424a360927cb90206e2002794a3054b37e

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.18-cp312-cp312-win_amd64.whl:

Publisher: release.yml on holmrenser/nj.rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nj_py-0.0.18-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nj_py-0.0.18-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d6aeca35e9c97e9f6481c8ac175eb4f1121fa902a719acd4564c2c474ba57c37
MD5 8c8267a53e3a50014cff11c9b3078c22
BLAKE2b-256 ef2cd594496a158012dffe59b96d3f030692a38b8084c7a16f0a752809e4fb3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.18-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on holmrenser/nj.rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nj_py-0.0.18-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nj_py-0.0.18-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9f2e6402f30a94ecd283712788d9f08a25bb471c1a1017a6ad8768a90ac266ce
MD5 29014b3d55843fe6ce5d5cf490292992
BLAKE2b-256 da39999e8e48dff2fe906e3399895adf4a9a63807b0dbb4132e3f09fbe100957

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.18-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on holmrenser/nj.rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nj_py-0.0.18-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for nj_py-0.0.18-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 5b795e341c07ca64add94b77912ba32f891483b2e6c8858135c8f3e4c650d692
MD5 8c7e087efe408bde4a7c1795ec4b4786
BLAKE2b-256 152d727a351ab1fc9af6dc983fa767d2896ad4236ef65a74d46052c8fa0c8dde

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.18-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: release.yml on holmrenser/nj.rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nj_py-0.0.18-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: nj_py-0.0.18-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 182.9 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nj_py-0.0.18-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f28b5b39428f4fa1f2ac3a1dfd5299f2a32ea502fd48ec59d7e6839b7166c9f8
MD5 1ab77eeb71e95cbbde4b3451926ba9ca
BLAKE2b-256 6cafb6e4a5af6d20a698862fa03fae27337c4efc7cf46f429953c8d9dbef16ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.18-cp311-cp311-win_amd64.whl:

Publisher: release.yml on holmrenser/nj.rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nj_py-0.0.18-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nj_py-0.0.18-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 def52a9beb07dc168be0c677652851bf4ba821773cf80557c0c27f242c1284c2
MD5 230f35318805e71335c83faae1efe464
BLAKE2b-256 ca3b85270ddd93fa324b96450b94793b5d64e18ebf79ba176e292e63ea52df2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.18-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on holmrenser/nj.rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nj_py-0.0.18-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nj_py-0.0.18-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a3120a088c8ae1f89b4a7e2b030c4d0c285ac8c6cf84514cd810933152ddccf6
MD5 69e28a2d75f62302f05a385bd35532cc
BLAKE2b-256 1d7a3a68d03c1cced44bfeeca40f1bb514b4b61cc7f17666fdc7b0c5013e55b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.18-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on holmrenser/nj.rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nj_py-0.0.18-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for nj_py-0.0.18-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 20126085a4aec780d34bef38e89d6f86b95d8f5705e310d11a42c6024715c447
MD5 1a37c9afedd95f7499e40f5a6013be42
BLAKE2b-256 bab3b7369eefb29b698fa4e8958835fd7aedc60873c8424952949ebfbd4f5643

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.18-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: release.yml on holmrenser/nj.rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nj_py-0.0.18-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: nj_py-0.0.18-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 182.6 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nj_py-0.0.18-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ecc76eb327997a989d8d47506a767c500d2847888d8d7db5acb71fa6adb2e74a
MD5 0ac3a5a69fd698e4a6d4cc98aa973f91
BLAKE2b-256 ea79f72f78f3ddf5022bfd6cbd550a5ca59e579dd7a9f9d4be49bbd1be8ed904

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.18-cp310-cp310-win_amd64.whl:

Publisher: release.yml on holmrenser/nj.rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nj_py-0.0.18-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nj_py-0.0.18-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5b293f156f8e35acc37adc6d2cf763f6a92d957a9719fe775d02cb5c9db7830a
MD5 134d7f0453806625bac5a8b6a94b2f7a
BLAKE2b-256 3b2784053c7071cfc7cb52eaa1fd51bd5de471ace1803e47b12965ba763434bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.18-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on holmrenser/nj.rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nj_py-0.0.18-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nj_py-0.0.18-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2ac5d6107ca3f614f9e3e11a2cc5741b069fbd38965c8421d8211e8b8a5df54e
MD5 67c3c2ab9c4fc902ab1705b18f04ab57
BLAKE2b-256 d930d90f69e7bcdb5a996641aa9fa9b322d24f48ad7510ad61e3888b54fe1c97

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.18-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on holmrenser/nj.rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nj_py-0.0.18-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for nj_py-0.0.18-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 813d5f9999ac9c6e69f9ec19d9247f91855bbea77529743fbc837a4d33b4a6ea
MD5 b76aeb9876293285d256f4f53b063d57
BLAKE2b-256 a99d8fdf1c5ad8fa52ea6d2b8f89b97a917230f3b496a0614a053d834869bedd

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.18-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: release.yml on holmrenser/nj.rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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