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.15.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.15-cp312-cp312-win_amd64.whl (173.4 kB view details)

Uploaded CPython 3.12Windows x86-64

nj_py-0.0.15-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.15-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (315.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

nj_py-0.0.15-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.15-cp311-cp311-win_amd64.whl (174.7 kB view details)

Uploaded CPython 3.11Windows x86-64

nj_py-0.0.15-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (324.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

nj_py-0.0.15-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.15-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.15-cp310-cp310-win_amd64.whl (174.6 kB view details)

Uploaded CPython 3.10Windows x86-64

nj_py-0.0.15-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (324.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

nj_py-0.0.15-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.15-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.15.tar.gz.

File metadata

  • Download URL: nj_py-0.0.15.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.15.tar.gz
Algorithm Hash digest
SHA256 af45ac3cc77f7196208e86b60f35bb5aa34d9111077c0803ab1459bbbc810a66
MD5 f3ab6fca4b47210fd30ef7ac9f8e7d98
BLAKE2b-256 107e006b4fc24ed683a56bad851d0e2fb17fc0af302ee78c0120bce3bd5e7f0f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: nj_py-0.0.15-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.15-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 51cf82eaec160182fa4ebf1bc22470209429bdd9d952c8444650b0ffe356f68d
MD5 c00ae509129f4192dd73769db8f7c1e2
BLAKE2b-256 dbfe069c26ac9fd684834b4f36b4f9417ee1f24f52821e4b2f6971b03d62f797

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for nj_py-0.0.15-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 23a9f1f68ea55332e0d52a2ff68ba682bdec5f3da02968965a62b07c5fe96afe
MD5 8e0a680ef7b27a240c9263863f3dd781
BLAKE2b-256 635aed372a10a5c900677486320ef37dcfa92b32aa8f3adc2f234c947a2f2213

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for nj_py-0.0.15-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 eee761495f38c30e6ab7a6fb784544feb7ee851d1cb6ae99ba87a48fb3f3c56f
MD5 63f372d5569841fc8b7d8ec29e7f1772
BLAKE2b-256 ffeede4d0827c14bcf067521ba82b6ce4d68441b55ba898bc09857cab221209d

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.15-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.15-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.15-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 127b14363fe0ba758231288491ab7661612ac6705c560afb9b0c08422b365bb8
MD5 8ee636be89d29e92d14d0475f63c5109
BLAKE2b-256 06746ba043e17f2a95b9e8fa2a0c3779ad3ceb5a9cca55b879adc8db6a1d9aa7

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: nj_py-0.0.15-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 174.7 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.15-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5c8a0ff117bf43fe0bc26effe0e44f87c66c230b1d55b4971fa120d574b93cec
MD5 daae815e89743517f3a95f11e7444d2c
BLAKE2b-256 aabb6bb676a3d13fb3c2b2391c4c255b7071a2ef6967f34aaa77570a871aa236

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for nj_py-0.0.15-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c54fd786f14853839191cdd42c6adf740a8a8dfa80a61e93cbe9903d767d7e65
MD5 143500c624313ed4b3cb42b6db1a4a19
BLAKE2b-256 f520ede20c452ae48904daff2d9ee89a0b68a71d620db777fad603a0f6c328a7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for nj_py-0.0.15-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b530b4fa96e1b8aa6a38a53615e8a9f8269be25870c0b20c1d4c894fd1f1df97
MD5 0618588d30652774f09a1d6c7c2b6209
BLAKE2b-256 523ea07bbc074bdc69529b461e9b305dc3998375d95a1b1e348f812772d6b7c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.15-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.15-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.15-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 398644b8fb257162c687d2c9a57b5f9b430e5c745fde9623379e351f4f97e8bc
MD5 c9fae6d8ce3e2e5516efb14b2d56c290
BLAKE2b-256 7f8d279a2c09ea5635782d021d440bc57185897dc808a4ef0c6349a5e794162e

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: nj_py-0.0.15-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 174.6 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.15-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b09ed79ea2ca037a8c0f9e74d8e50cef74c7702f4d1e3db7a7f7cc458089a094
MD5 06cb085e638640bbc670903e7bfb1656
BLAKE2b-256 f8a953fad886bbad836d3ce6f782975aee6183df91eee21388e240103a21b273

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for nj_py-0.0.15-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 904150fb812150f1e9a4c6246a75eee4855c903627edfeb442533809a6e1349a
MD5 f278cbd18adadd0ddfd9e49833764245
BLAKE2b-256 f67fac859fd83e76227f21767ae547adce511469f2f9b6e7cbce58ab011cfa1f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for nj_py-0.0.15-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 07d1a0783df51e45c69e0f269b8ae01e38dcb788b29141e3e77645dd4e9ad923
MD5 2111274d9fb727cdb5b82727d6479ed2
BLAKE2b-256 3e7d3a445a871233863b289844fcd52dff68a27a6ea0c20443431855a079726f

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.15-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.15-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.15-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 37c572ac813b3fb38075d1a5b3c3358232f38003ba79074c7e46fda3566b687c
MD5 b43fb8950e39a6bdc4a700f22e7b105a
BLAKE2b-256 3d309251ebc9de53c57c9467e33b80d079c36aa350772c7a1576794b1ceda052

See more details on using hashes here.

Provenance

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