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.16.tar.gz (43.5 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.16-cp312-cp312-win_amd64.whl (173.4 kB view details)

Uploaded CPython 3.12Windows x86-64

nj_py-0.0.16-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (323.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

nj_py-0.0.16-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (315.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

nj_py-0.0.16-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (559.4 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.16-cp311-cp311-win_amd64.whl (174.6 kB view details)

Uploaded CPython 3.11Windows x86-64

nj_py-0.0.16-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (324.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

nj_py-0.0.16-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (317.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

nj_py-0.0.16-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (563.9 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.16-cp310-cp310-win_amd64.whl (174.5 kB view details)

Uploaded CPython 3.10Windows x86-64

nj_py-0.0.16-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (324.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

nj_py-0.0.16-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (317.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

nj_py-0.0.16-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (564.0 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.16.tar.gz.

File metadata

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

File hashes

Hashes for nj_py-0.0.16.tar.gz
Algorithm Hash digest
SHA256 3366eb5382370e64a30c8231f277b13712eb51bd50d52cd5f2e1a5b282d5f0c3
MD5 3e09ebc365c343a31689d7aa7c00869f
BLAKE2b-256 919dfee7a9ee70fe102891d17dd56d00da0bc09cd478b8265df8a7aaa7f42fde

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.16.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.16-cp312-cp312-win_amd64.whl.

File metadata

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

File hashes

Hashes for nj_py-0.0.16-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 35ad3853b96ec5bc3121fafd54f3a4c11763900ac2d4c96c91502bbdd71c44f5
MD5 e1c33b9dd578ca99221fddd7b600a155
BLAKE2b-256 148f1b6a62d352dc5111d09ad77d0ba5723d9fd1482ce9d66dce77a270715125

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.16-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.16-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nj_py-0.0.16-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f5eb725e5ca07ebc632d7982d8a8b2a6eff9954d97c4b6c40f30d3dbe57a445f
MD5 22a67abb5fc2f4a2996d53255cc36911
BLAKE2b-256 919462f45b7704c1f1a3d4fbe6fc82525d3b8b8daf49fe9cdc6910ad2cd78c98

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.16-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.16-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nj_py-0.0.16-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bc151cfca12875dc5d1ebaaedab15c922651623dbed837ca2c0f89cc20a3c0d1
MD5 126373be359372a6f5c03491539473da
BLAKE2b-256 ca8db4f7ee881f7b17b40ca7f08abb0a1035d3529b383ff8654c3c2894f47f53

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.16-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.16-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.16-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 ac5b3a1881f31c13888ac1feed76bc46f2d6dece0db288b465ce312e3190a467
MD5 d4ea8150ab2d57a5373b63130a76efec
BLAKE2b-256 655908f9bbfa4bb55d22f0aea9fd307da004a0ca5e6898083f54f20a1c101e50

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.16-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.16-cp311-cp311-win_amd64.whl.

File metadata

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

File hashes

Hashes for nj_py-0.0.16-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a8d44218199500bb256f8c73e9d652408e43b20c6f2e643539fa996fcdc0b0f1
MD5 84ee3d4989e0e5563ff39c77cf484733
BLAKE2b-256 f395714d18ffb622e038fa41b78904a71cc73845fa86da6b17741b11ee226edd

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.16-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.16-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nj_py-0.0.16-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c3084b581a27496e76c100354cb044c4ccf3b03c04255b55ee4e154076fc85c4
MD5 5de7fd2d090d25ad921bec021b8d9443
BLAKE2b-256 7fd40239ef69377d1685381fed7ec8549f8d16ef972ae223a9690dc72ab1975c

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.16-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.16-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nj_py-0.0.16-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 015b5a2c25d74209bf040118dc9ae634abe530834c6dcc674b124539350757d7
MD5 b0a4dc6c0cd260f753d6014b903aa035
BLAKE2b-256 96e39fb60b089b539d08c2f840e2cfe9543c3ad47309a20103bc33b4e189eab5

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.16-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.16-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.16-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 2e91056dbfc03de6fe3e7ac4aaef976d67f659e3c80d42e6e409c534513bfe5e
MD5 5417155cefed7c102a1105552f1a15ae
BLAKE2b-256 eaaa7e68d52ff9e1b141fb8844c5949d8f35a4932452ee9d232cc970d382ce32

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.16-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.16-cp310-cp310-win_amd64.whl.

File metadata

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

File hashes

Hashes for nj_py-0.0.16-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5be64e600952c8da9575179285bd7cafd7bfb2e74a8ee5bab9ac860455e33307
MD5 dfc5603cb477e0fbad7e939f761e09c6
BLAKE2b-256 6c1b676a0738fe9c2a2c361fe188afddad8baf34784fd74dce6f76f7cb8a8551

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.16-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.16-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nj_py-0.0.16-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a2d54aa8f355d9f3932a9e6fea4d54d0c36bb7696ed8169efd30511a518631d6
MD5 3691cc01cbd5d38b018f0c469a109554
BLAKE2b-256 8645d70b2cd67ae76236f584261e0a9c2036bdea82fb5e281975a10fdcf5b385

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.16-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.16-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nj_py-0.0.16-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6a086935eb61f1ac3c90eac845c57d4f8e159955707b01fcab73bd8eacc84941
MD5 dd5ff2c6d4a480a407aaed97ef63efbc
BLAKE2b-256 9c349181170ee7271a87beb0618f69a2d6baa6f2742ca30f3e57c0918f089d99

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.16-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.16-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.16-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 4f5764ca098422aaa824a440ffb3bc09f13f3c1dc08fd08f7bfe63890a033744
MD5 2c402de8cdb44ec85320508d0a4be4b4
BLAKE2b-256 7a4c52d98d1e86880ea305d964965a2bf31bbe906a5fedde3f60565e96424ead

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.16-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