Skip to main content

Rust port of BandNorm's scGAD + bandnorm normalization for single-cell Hi-C — bit-equivalent to the R reference, ~10-30× faster.

Project description

rust-bandnorm

Rust port of BandNorm (Shen, Zheng, Keleș 2022) — single-cell Hi-C scGAD scoring and band-normalisation for cell-type discovery and downstream embedding.

This is a separate package that re-implements the algorithm in Rust; it is not a fork of the upstream R tree. The original R implementation continues to be available at https://github.com/sshen82/BandNorm.

What it computes

Two functions, mirroring BandNorm/R/scGAD.R and BandNorm/R/bandnorm.R:

import bandnorm_rs as bn

# scGAD: gene × cell matrix from contact pairs.
gad = bn.scgad(hic_df, genes, resolution=10_000, depth_norm=True)

# BandNorm: per (chrom, diagonal, cell) depth-normalisation of contact counts.
norm_df = bn.bandnorm(hic_df)

Both are bit-equivalent (within f64 ε) to the R reference and faster by ~10-30× depending on the dataset.

Algorithm parity

tests/test_parity.py compares the Rust output against an R reference generated via pure GenomicRanges (no GenomicInteractions dependency) on the official BandNorm-shipped scGADExample.rda + mm9Annotations data: 100 cells × ~1.3 M contact pairs × 10180 genes.

Tolerance: max |Rust − R| < 1e-10 on raw counts (integer-exact), < 1e-6 on Z-scored GAD output.

Install

git clone https://github.com/omicverse/rust-bandnorm
cd rust-bandnorm
maturin develop --release

PyPI release coming soon (pip install bandnorm-rs).

Layout

rust-bandnorm/
├── pyproject.toml
├── rust/Cargo.toml
├── rust/src/lib.rs              # ~250 LoC: gene index + scGAD + bandnorm
├── python/bandnorm_rs/        # Python wrapper
└── tests/
    ├── reference_scgad.R        # R reference generator
    └── test_parity.py           # pytest parity vs R

License

MIT.

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

bandnorm_rs-0.1.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distributions

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

bandnorm_rs-0.1.0-cp39-abi3-win_amd64.whl (212.0 kB view details)

Uploaded CPython 3.9+Windows x86-64

bandnorm_rs-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (345.8 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

bandnorm_rs-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (347.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

bandnorm_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl (305.8 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

bandnorm_rs-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl (311.4 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file bandnorm_rs-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for bandnorm_rs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3d1eed938089da829f65df18e2a8320580890ffc6020d79829430f5f03861544
MD5 33633bad7f10cce5db2d0dc0e705a7f5
BLAKE2b-256 7c8c4c2ab48cd8fef15372d59e09f02da7a8416ebcad0d54acd446ed79be2226

See more details on using hashes here.

Provenance

The following attestation bundles were made for bandnorm_rs-0.1.0.tar.gz:

Publisher: release.yml on omicverse/rust-bandnorm

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

File details

Details for the file bandnorm_rs-0.1.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: bandnorm_rs-0.1.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 212.0 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bandnorm_rs-0.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 07d06e266396500784c3364eaf120bb461022be0e8890a004ed98f95596c94b6
MD5 92f7b7b7d26651bdc65daa4e1906493b
BLAKE2b-256 fcee7b8fbb986044976888cb6bdd6acb656cfb0ef10aac2b0f51c60ad072c1d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for bandnorm_rs-0.1.0-cp39-abi3-win_amd64.whl:

Publisher: release.yml on omicverse/rust-bandnorm

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

File details

Details for the file bandnorm_rs-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bandnorm_rs-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 580f5e1c240c4159eed333ee2975f6345299115f5eb3d0b2df927c1a7b3bc71e
MD5 ca9ac983cc47b22e6402440bf7ce86e5
BLAKE2b-256 c487b1cbd87bfdffc0c93c164a597517adff0fb0b9f01e4c6fa383a985d6a7d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for bandnorm_rs-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on omicverse/rust-bandnorm

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

File details

Details for the file bandnorm_rs-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bandnorm_rs-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9b56e20452cfe3c131d3a9fa0ceafc0ff755fbf7b8d99f9eb0eeaa0eea970139
MD5 c64c0f39359f6a1a9f4b57b3b0695bee
BLAKE2b-256 d899f8a8e9b2ea2245f30fc72966390f2aca6a1de6daaecc2caf09ee835a93e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for bandnorm_rs-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on omicverse/rust-bandnorm

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

File details

Details for the file bandnorm_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bandnorm_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c9b0f0bf7135d12ac54e22791ac18cbd51a039aa693a758ce913d41808fab09d
MD5 460549d18bda1364c8351d577e2e6541
BLAKE2b-256 adcde7ac3b1c59c5e3335307944d85bf9d068f5e57abf631a236c0e9097d72bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for bandnorm_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on omicverse/rust-bandnorm

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

File details

Details for the file bandnorm_rs-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for bandnorm_rs-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c336149cada87b8667184285f4e564e3ca7324f9bf86b787cc68eb632ea524fb
MD5 990702b87d6906186bd090665230ac22
BLAKE2b-256 176afb74ee1f116e368fd23a8a1c144f4af3976a36c27a5aa6022f370e63bda8

See more details on using hashes here.

Provenance

The following attestation bundles were made for bandnorm_rs-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on omicverse/rust-bandnorm

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