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

Uploaded CPython 3.12Windows x86-64

nj_py-0.0.14-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.14-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.14-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (559.2 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.14-cp311-cp311-win_amd64.whl (174.6 kB view details)

Uploaded CPython 3.11Windows x86-64

nj_py-0.0.14-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.14-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.14-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (563.6 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.14-cp310-cp310-win_amd64.whl (174.5 kB view details)

Uploaded CPython 3.10Windows x86-64

nj_py-0.0.14-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.14-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (317.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

nj_py-0.0.14-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (563.8 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.14.tar.gz.

File metadata

  • Download URL: nj_py-0.0.14.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.14.tar.gz
Algorithm Hash digest
SHA256 7aa86fc2c2f40b47e0d272c50a207bfab8bd5001409e79e38c726f8f5cd30205
MD5 9d9123f69252797055b6adde9fb2b9be
BLAKE2b-256 4ba903f11b92e5cf1920b26267dd3696948c696e42ea42c6556af6ce018d59b3

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: nj_py-0.0.14-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.14-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9662351379f7bfe372f696beff65a31fcb38fd2979c9aa424be2337b4a9cd5b4
MD5 398f8f3a0782a5f8d8909a534f10b0cc
BLAKE2b-256 cd917d6434c14478aee5a8e80edc97bab467fdb25d6ec1f97b5f5bcce721546b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for nj_py-0.0.14-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 335e50c808a4495a84fbb0b1258490104a9768ada0c87c44fceaada51c4ba2a1
MD5 601a0ca697fa0374f2376117d2c2a8e4
BLAKE2b-256 3c935800585483178f74c6282456c87398d22819bdf1ac911a87af6182fab5e6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for nj_py-0.0.14-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d2e2f9ae5db1c34d1aa293927065b07be0da8d3cebb9d9bf7079f4f8ed3bb4e4
MD5 c13d4fd45d56462a2f401639a8eb3488
BLAKE2b-256 e55543bad2585effd78199425b66fb95d9cb77875daf9c8f67d54331edbf3759

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.14-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.14-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.14-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 d761ba467b499e1d30ff38d261f1fd0a0331bfa2bc8f72842968a4c7198e32aa
MD5 87b3b20e3d03922b8c85f6fc13296b87
BLAKE2b-256 6ee30d25848df6d605c44b39906662068880f9ef1dd740711243089abcec1779

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: nj_py-0.0.14-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.14-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a0d308463c0614150bbc821223e2c268ef9f61398417001606a16c7bb845c3c4
MD5 eea40d162fc909726b7a2337e8142a48
BLAKE2b-256 b3eba9d170a6196f7b9c1a0c82a989cde58905ca74ede4163f1c1ec6911e6fc2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for nj_py-0.0.14-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2338e0266b5028822c98a7dde6cbabf1d7ff520e2f63e3dd394a858a1ed80d82
MD5 9989c12ed2d559c446a2590958a8da0e
BLAKE2b-256 810d10ee8e318eaedaa06f29f11c4604ddce627a35151332d38cba05ed2fb600

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for nj_py-0.0.14-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e877687aa49c52f87b98eba948d27d9e2c7202aa119de8273fd89fec47643252
MD5 645f3e3a25991794af6ec9bb88bd0a66
BLAKE2b-256 40932b2749edc71f812462340661532bcdeb2530e8b091a1a4f3b1c59f1de311

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.14-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.14-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.14-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 55540c2afba37dfeffaf18744b4a0aff81c444d8ed6acf8e24a8b7c06dadcc45
MD5 8caa43145ba6b1bc1366bda139d40d2b
BLAKE2b-256 8394a21b7487dbf11807bbdcca69d408c70add201bbbaf7fc98291286c5c22cf

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: nj_py-0.0.14-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.14-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 859c6f84c942f9baeb1e7f6444d30ecc960d247c7c6b676eb3d480ad3d136dec
MD5 e6f9c5b1624cd962b6ba8aa6398100b8
BLAKE2b-256 6ec9e686b927b3f9f3db669bd2dae6be7bff6cdb49bb102d4029778fc59acb28

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for nj_py-0.0.14-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a094c9c9757f143a08c3c63e7c9bf3cb2855204ed8811ff8704483632a4f7f79
MD5 de2480434e874e9d930482abc8c52661
BLAKE2b-256 f17bf56c3c17c6435c2b6f6baf91e2d934d8581c98a5034d5c40e0468a2f32b9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for nj_py-0.0.14-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b919f4e973132d47f8fd41de58e210ef89ad7ff4e5f9475e4b6957da24862d7e
MD5 44c91f059d2b3025a724cb266a15c49a
BLAKE2b-256 6477abb0e5789cb0e6038ef85624d2669892274185f912e245e0b092af9634bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for nj_py-0.0.14-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.14-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.14-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 9e9abaac3b6cda4e7048228072864fb4b857ee28cfaa4af8946abfc33486c73b
MD5 2e864626da7ba625ee61a59e95d1c748
BLAKE2b-256 64db766c173662ef86bc7ed283d36811d43bb478721df73991be03b9f684f5a8

See more details on using hashes here.

Provenance

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