BamNado
High-performance tools and utilities for manipulation of BAM files for specialized use cases, including single cell and MCC (Multi-modal cellular characterization) workflows.
Overview
BamNado is a Rust-based toolkit designed to handle complex BAM file operations that are common in modern genomics workflows, particularly in single-cell and multi-modal cellular characterization experiments. It provides efficient, cross-platform tools for coverage calculation, read filtering, file splitting, and various BAM file transformations.
Python Interface
BamNado also provides a Python interface for direct access to its high-performance BAM processing capabilities.
Installation
You can install the Python package directly from the source using pip or uv:
# or
Usage
# Get coverage signal for a chromosome
=
# signal is a numpy array of floats
Installation
BamNado can be installed in several ways. Choose the method that best fits your needs:
Method 1: Pre-built Binaries (Recommended)
The easiest way to get started is to download a pre-compiled binary from our releases page.
Available Platforms
| Platform | Architecture | File Name |
|---|---|---|
| Linux | x86_64 | bamnado-x86_64-unknown-linux-gnu.tar.gz |
| macOS | Intel (x86_64) | bamnado-x86_64-apple-darwin.tar.gz |
| macOS | Apple Silicon (ARM64) | bamnado-aarch64-apple-darwin.tar.gz |
| Windows | x86_64 | bamnado-x86_64-pc-windows-msvc.zip |
Installation Steps
-
Download the binary
Go to the releases page and download the appropriate file for your system.
-
Extract the archive
Linux/macOS:
Windows:
- Right-click the zip file and select "Extract All"
- Or use your preferred extraction tool (7-Zip, WinRAR, etc.)
-
Make executable (Linux/macOS only)
-
Test the installation
You should see output like:
bamnado 0.3.2 -
Install system-wide (optional but recommended)
Option A: System-wide installation (requires admin privileges)
# Linux/macOS # Windows (as Administrator) # Copy bamnado.exe to C:\Windows\System32\ or add to PATHOption B: User-local installation (no admin required)
# Linux/macOS # Add to your shell profile if not already in PATH # or for zsh users: # Reload your shell or run: -
Verify system installation
Open a new terminal and run:
Troubleshooting Pre-built Binaries
Linux: "No such file or directory" error
-
Your system might be missing required libraries. Try:
-
For older Linux distributions, you may need to build from source.
macOS: "Cannot be opened because the developer cannot be verified"
- Run:
xattr -d com.apple.quarantine bamnado - Or go to System Preferences → Security & Privacy and allow the app
Windows: "Windows protected your PC"
- Click "More info" → "Run anyway"
- Or add an exception in Windows Defender
Method 2: Install via Cargo
If you have Rust and Cargo installed, you can install BamNado directly from crates.io:
Prerequisites:
- Rust 1.70+ (install from rustup.rs)
- Cargo (comes with Rust)
Advantages:
- Always gets the latest published version
- Automatically handles dependencies
- Works on any platform supported by Rust
Method 3: Build from Source
For the latest development version or if pre-built binaries don't work on your system:
Prerequisites
- Rust 2024 edition or later
- Git
- C compiler (for some dependencies)
Install Rust if you haven't already:
|
Build Steps
-
Clone the repository
-
Build the project
# Debug build (faster compilation, slower execution) # Release build (slower compilation, faster execution - recommended) -
Test the build
# For debug build # For release build -
Install system-wide (optional)
# Install from source # Or manually copy the binary
Build Troubleshooting
Common Issues
Error: "linker 'cc' not found"
- Ubuntu/Debian:
sudo apt install build-essential - CentOS/RHEL:
sudo yum groupinstall "Development Tools" - macOS: Install Xcode Command Line Tools:
xcode-select --install - Windows: Install Visual Studio Build Tools or use WSL
Error: "failed to run custom build command for 'openssl-sys'"
- Ubuntu/Debian:
sudo apt install libssl-dev pkg-config - CentOS/RHEL:
sudo yum install openssl-devel pkgconf-pkg-config - macOS: Usually works out of the box with Homebrew
- Windows: Consider using the pre-built binaries instead
Quick Start Verification
After installation, verify everything works:
# Check version
# See available commands
# Test with a simple command (replace with your BAM file)
Usage
Available Commands
BamNado provides several commands for different BAM file operations:
bam-coverage- Calculate coverage from a BAM file and write to a bedGraph or bigWig filemulti-bam-coverage- Calculate coverage from multiple BAM files and write to a bedGraph or bigWig filesplit-exogenous- Split a BAM file into endogenous and exogenous readssplit- Split a BAM file based on a set of defined filtersmodify- Modify BAM files with various transformations
For detailed help on any command, use:
Example: Calculating Coverage from a BAM File
Command
Explanation of Options
--bam: Path to the input BAM file.--output: Path to the output file (e.g.,bedGraphorBigWig).--bin-size: Size of genomic bins for coverage calculation.--norm-method: Normalization method (raw,rpkm, orcpm).--scale-factor: Scaling factor for normalization.--use-fragment: Use fragments instead of individual reads for counting.--proper-pair: Include only properly paired reads.--min-mapq: Minimum mapping quality for reads to be included (default: 20).--min-length: Minimum read length (default: 20).--max-length: Maximum read length (default: 1000).--blacklisted-locations: Path to a BED file specifying regions to exclude.--whitelisted-barcodes: Path to a file with barcodes to include.--strand: Filter reads based on strand (both, forward, reverse).--shift: Shift options for the pileup (default: 0,0,0,0).--truncate: Truncate options for the pileup.--ignore-scaffold: Ignore scaffold chromosomes.--read-group: Selected read group.
Output
The output file (output.bedgraph) will contain the normalized coverage data for the BAM file, filtered based on the specified criteria. BigWig files can also be generated by specifying the --output option with a .bw extension.
Additional Commands
Multi-BAM Coverage
To calculate coverage from multiple BAM files:
Split BAM File into Endogenous and Exogenous Reads
To split a BAM file into endogenous and exogenous reads:
Split BAM File by Cell Barcodes
To split a BAM file based on cell barcodes:
Modify BAM Files
To modify BAM files with various transformations:
The modify command supports various filtering options and transformations like Tn5 shifting for ATAC-seq data processing.
Help
For more details on available commands and options, run:
Or for specific command help:
Features
- High Performance: Built in Rust for maximum speed and memory efficiency
- Cross-platform: Available for Linux, macOS, and Windows
- Multiple Output Formats: Support for bedGraph and BigWig output formats
- Flexible Filtering: Comprehensive read filtering options including mapping quality, read length, proper pairs, and more
- Single Cell Support: Built-in support for cell barcode-based operations
- MCC Workflows: Specialized tools for Multi-modal Cellular Characterization
- Strand-specific Analysis: Support for strand-specific coverage calculations
- Blacklist/Whitelist Support: Region and barcode filtering capabilities
Development
Requirements
- Rust 2024 edition or later
- Cargo package manager
Building from Source
Running Tests
Pre-commit Hooks
This project uses pre-commit hooks to ensure code quality and consistency. The hooks run the same checks as the CI workflow:
- Code formatting (
cargo fmt) - Linting (
cargo clippy) - Basic checks (
cargo check) - Tests (
cargo teston push)
Quick Setup
Run the setup script to install and configure pre-commit hooks:
Manual Setup
If you prefer to set up pre-commit manually:
# Install pre-commit (choose one method)
# or: brew install pre-commit
# or: conda install -c conda-forge pre-commit
# Install the hooks
# Test the setup
Configuration Options
Two pre-commit configurations are available:
.pre-commit-config.yaml- Full checks includingcargo checkon every commit.pre-commit-config-fast.yaml- Faster setup with formatting/linting only, tests on push
To use the fast configuration:
Useful Commands
Release Information
Version 0.3.1 (2025-07-09)
- Initial public release with comprehensive BAM file manipulation tools
- Support for single cell and MCC (Multi-modal Cellular Characterization) use cases
- Cross-platform binary builds available for Linux, macOS, and Windows
- High-performance Rust implementation
- Complete CI/CD pipeline with automated testing and releases
For detailed changelog information, see CHANGELOG.md.
License
This project is licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.