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.17.tar.gz (44.3 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.17-cp312-cp312-win_amd64.whl (168.6 kB view details)

Uploaded CPython 3.12Windows x86-64

nj_py-0.0.17-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (289.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

nj_py-0.0.17-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (285.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

nj_py-0.0.17-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (533.0 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.17-cp311-cp311-win_amd64.whl (169.8 kB view details)

Uploaded CPython 3.11Windows x86-64

nj_py-0.0.17-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (289.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

nj_py-0.0.17-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (286.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

nj_py-0.0.17-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (534.2 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.17-cp310-cp310-win_amd64.whl (169.8 kB view details)

Uploaded CPython 3.10Windows x86-64

nj_py-0.0.17-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (290.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

nj_py-0.0.17-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (286.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

nj_py-0.0.17-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (534.4 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.17.tar.gz.

File metadata

  • Download URL: nj_py-0.0.17.tar.gz
  • Upload date:
  • Size: 44.3 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.17.tar.gz
Algorithm Hash digest
SHA256 0d0296402821f040877c9bfb45be5f5e143af1b343920e629357668ed0e0d42d
MD5 1643198114134f0a7a17002b33894b23
BLAKE2b-256 208fd05056098ecb87bf27cf346901865efdc24289d415c562d0cff0894f1f42

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: nj_py-0.0.17-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 168.6 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.17-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 69a0138e9ca98ab960d93dee7e9c0d4fe3b27cfff90cf96c0452265cfd4ca197
MD5 b32e00b6bcb0630fd951b894c95cb2cb
BLAKE2b-256 a536a6af0d67c962d7e8e084040db8112e4defd4c06b4666e7fa81299d0c143f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for nj_py-0.0.17-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 219d925b5b532f2940c0a12174b332c084fa92ffa6189d5f9c88e8847b883f8a
MD5 a59f2bdf6c4b980596793c1e0de8309b
BLAKE2b-256 bdf7ee98df7f3ffac1a4150f5e9269f6651d79d784b6352b9f4c2eb4cde69d1f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for nj_py-0.0.17-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bcb8590d3e382e87599ef082b3e1fd906ab83b736e8d5045c7be85d87e7ee81a
MD5 b4408c1eb2d02964c4f91917c57646ca
BLAKE2b-256 fa2d4bf08b21d81ab73d2b4705e0b6bda02152d6d5c6b922baf7b2fbc909a8cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.17-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.17-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.17-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 082fb27932d7024efd80e8dc427a105a429de162320908ab81f1959f08d04a12
MD5 60bda5e1e9facb7ba5273df81dd78086
BLAKE2b-256 1fd75c5165857602745c73bd645038a2fa4b7b8b609a78a648486e88ced59140

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: nj_py-0.0.17-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 169.8 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.17-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7c50224ab45e7f011225b6684cf2095d425c84cda3d44a05dd3b2cd1ce458a00
MD5 9d62986a42fe6ab5f52636ec4dcb021e
BLAKE2b-256 304586532022a36cdc5ccb17746726130674090c915a22f3a743025f2700ce14

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for nj_py-0.0.17-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a495ceb06147d7037ee3db10a92667854841dd408ae6c5722e0d09658bdc6d55
MD5 96cc41d0df31450c681e7ed6b40f2c33
BLAKE2b-256 a533eaed7ade0a3369b2097a2bb77f1a6c32f87e24f5198d5b206bf9007b1444

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for nj_py-0.0.17-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4f0d02fbb8746ddd326424942dc386a57c8c19ada60bf2bd17a10be5acfabec9
MD5 c1fb2bfa7a1d613f64ac8f059b732e59
BLAKE2b-256 368bad6a8ecc3b840b653491b22e28c48a15f7459ac7927aca8e7faae9c56dce

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.17-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.17-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.17-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 bb48b295731fc4a8a61b271ae0d067b3bd617b33ddfea481a985a575fa481a5c
MD5 59d511f22d646942bb17712501eff24a
BLAKE2b-256 2b8b9cf06e30252ea1072a2fcc6a7a2e2656f2688b8f4ee38b15209aa9f3e707

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: nj_py-0.0.17-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 169.8 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.17-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3206ad3dfe5d28fcb1b89075e23eccb6b9c3b1f6a426ac06f65d4210c59d3864
MD5 759d2057fbcb07a4e6b1389f223863e9
BLAKE2b-256 eb9e1a654555a1472c572312d8f64d0f3a34c38f616061754f04424f7c2509b1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for nj_py-0.0.17-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 08091848d905e7031a03022cb80fcafa94a3fb0ff85de6bb340f9727f7db4a92
MD5 cb4ef72aa7ade1730d450a73eb27857e
BLAKE2b-256 e34db54e21b01ecb371cd24e19aac91eedca526193e6d8853f307a9f3776a7d3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for nj_py-0.0.17-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 36889f1dfedd1d4cb6d9f98b86de17b36ba028d762bfca653df7ded14fcec820
MD5 2cbbd96461d5cb1794da828d0cdbfccd
BLAKE2b-256 cadcda6856046efbf0ca1c54764a16897c46342e28169a8d99738424bf491a51

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.17-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.17-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.17-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 7ac3a8bee2b961e3a1aa35aa27ec3abdbcaa62785ea946177ce6996b3824fd03
MD5 87ebdafda97388973018fc125a2d11b7
BLAKE2b-256 643f316a918d30e20324eded544492fd47fad6711c98ab53ba4b1e19baf06042

See more details on using hashes here.

Provenance

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