Skip to main content

Python bindings for BamNado

Project description

BamNado

High-performance tools and utilities for working with BAM and BigWig files in modern genomics workflows. BamNado is written in Rust for speed and low memory use and provides both a command-line interface and Python bindings.


Overview

BamNado is designed for efficient, streaming manipulation of BAM files and signal tracks. It focuses on fast coverage generation, flexible filtering, and lightweight post-processing of bedGraph and BigWig data.

Common use cases include:

  • Rapid generation of coverage tracks from large BAM files
  • Filtering reads by tags or barcodes to produce targeted BigWigs
  • Fragment-aware coverage for ATAC-seq and related assays
  • BigWig comparison and aggregation across samples
  • Post-processing of binned signal tracks for visualization

BamNado is useful in a range of workflows, including single-cell and Micro-Capture-C (MCC), but is not limited to those applications.


Features

  • High-performance, streaming implementations in Rust
  • Cross-platform support (Linux, macOS, Windows)
  • BAM → bedGraph / BigWig coverage generation
  • Fragment-aware and strand-specific pileups
  • Read filtering by mapping quality, length, tags, and barcodes
  • BigWig comparison (subtraction, ratio, log-ratio)
  • BigWig aggregation (sum, mean, median, min, max)
  • collapse-bedgraph utility to merge adjacent bins with identical scores
  • Python bindings for selected functionality

Installation

Pre-built binaries (recommended)

Download the appropriate binary from: https://github.com/alsmith151/BamNado/releases

After downloading:

chmod +x bamnado
./bamnado --version

(Optional) install system-wide:

sudo cp bamnado /usr/local/bin/

Docker

docker pull ghcr.io/alsmith151/bamnado:latest
docker run --rm ghcr.io/alsmith151/bamnado:latest --help

Images are available for linux/amd64 and linux/arm64.


Cargo

If you have Rust installed:

cargo install bamnado

Build from source

git clone https://github.com/alsmith151/BamNado.git
cd BamNado
cargo build --release

Python Interface

BamNado provides Python bindings for selected high-performance operations and is available directly from PyPI.

Installation

pip install bamnado
# or
uv pip install bamnado

Example

import bamnado
import numpy as np

signal = bamnado.get_signal_for_chromosome(
    bam_path="input.bam",
    chromosome_name="chr1",
    bin_size=50,
    scale_factor=1.0,
    use_fragment=False,
    ignore_scaffold_chromosomes=True
)

print(f"Mean coverage: {np.mean(signal)}")

Command-line usage

List available commands:

bamnado --help

Get help for a specific command:

bamnado <command> --help

Available commands

  • bam-coverage – generate coverage from a BAM file
  • multi-bam-coverage – coverage from multiple BAMs
  • split – split BAMs based on filters (e.g. barcodes)
  • split-exogenous – split endogenous vs exogenous reads
  • modify – apply transformations and filters to BAMs
  • bigwig-compare – compare two BigWigs
  • bigwig-aggregate – aggregate multiple BigWigs
  • collapse-bedgraph – merge adjacent bedGraph bins with identical scores

Example: BAM coverage

bamnado bam-coverage \
  --bam input.bam \
  --output output.bedgraph \
  --bin-size 100 \
  --norm-method rpkm \
  --scale-factor 1.5 \
  --use-fragment \
  --proper-pair \
  --min-mapq 30

Example: tag-filtered BigWig generation

bamnado bam-coverage \
  --bam input.bam \
  --output BCL2.bw \
  --bin-size 50 \
  --filter-tag "VP" \
  --filter-tag-value "BCL2" \
  --use-fragment \
  --min-mapq 30

BigWig comparison

bamnado bigwig-compare \
  --bw1 sample1.bw \
  --bw2 sample2.bw \
  --comparison log-ratio \
  --pseudocount 1e-3 \
  -o output.bw

BigWig aggregation

bamnado bigwig-aggregate \
  --bigwigs sample1.bw sample2.bw sample3.bw \
  --method mean \
  -o aggregated.bw

collapse-bedgraph

bamnado collapse-bedgraph \
  --input signal.bedgraph \
  --output signal.collapsed.bedgraph

Development

cargo build --release
cargo test

License

Apache-2.0 OR 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

bamnado-0.4.4.tar.gz (86.7 kB view details)

Uploaded Source

Built Distributions

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

bamnado-0.4.4-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

bamnado-0.4.4-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB view details)

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

bamnado-0.4.4-cp310-abi3-macosx_11_0_arm64.whl (626.1 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

bamnado-0.4.4-cp310-abi3-macosx_10_12_x86_64.whl (668.1 kB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file bamnado-0.4.4.tar.gz.

File metadata

  • Download URL: bamnado-0.4.4.tar.gz
  • Upload date:
  • Size: 86.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.11.5

File hashes

Hashes for bamnado-0.4.4.tar.gz
Algorithm Hash digest
SHA256 00b780c744c99aa84ca34f8cef302653c4a747f1d0c5ced1a28dbdd6c2874579
MD5 f2bc14ce249cf1b9c1ccfbbb1f947c73
BLAKE2b-256 d1961976a6e48765cd77dd8318d437e0189fdfad5546453e7bf9f0a6e0c60935

See more details on using hashes here.

File details

Details for the file bamnado-0.4.4-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bamnado-0.4.4-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e87ed439c972a5222fe9d9b6a0d397cf8a28339ebd33ce39540d68f1c033905c
MD5 be2c49243e6ec755f9ad3390b920319e
BLAKE2b-256 2678002d5de610627515be0b9699f8fb4228a5de90d1712e066d20ff559ed780

See more details on using hashes here.

File details

Details for the file bamnado-0.4.4-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bamnado-0.4.4-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bbd1259735a477e75a1c5d65d6093a58d54f46d62b23638c079029831116b669
MD5 1583d490ab03b6c4e4359422e4d358e8
BLAKE2b-256 c1684692f8436f3d3524ecc3903ab1f322552565d4b86e5ae66a6efa8f5a519e

See more details on using hashes here.

File details

Details for the file bamnado-0.4.4-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bamnado-0.4.4-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 90fad7d1e3e4ddaf19da86da9a1426c0c0847d67dd1d9352c313e45728dce1a4
MD5 724bd5aad298b012b4f48f4c20a37a09
BLAKE2b-256 708941207ac13c593a0d8dc0c9180db051bd34659a12d1828ed1398108829d47

See more details on using hashes here.

File details

Details for the file bamnado-0.4.4-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for bamnado-0.4.4-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7a01d0792f2481bcc75d7b8de6b42b55a244112e3292178c3c81991c82029440
MD5 d4a6bac8ad1b76f37ac39f35921fd357
BLAKE2b-256 724bdc62a55b2ce3a0fcb94ec95de87b98de04d1c987f0a03670b315ba4ccbdb

See more details on using hashes here.

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