A Rust-based BAM depth calculator for Python.
Project description
🦀 rustbam - Rust-powered fast BAM depth extraction with Python bindings
rustbam is a high-performance BAM depth calculator written in Rust, with Python bindings for fast and efficient genomic data analysis.
📦 Installation
Install from PyPI (No Conda Required)
You can install rustbam directly with pip:
pip install rustbam
🛠️ Usage
Python API
After installation, you can use rustbam in Python:
import rustbam
positions, depths = rustbam.get_depths(
bam_path, # path to bam file
chromosome, # chromosome/contig name
start, # 1-based inclusive start coordinate
end, # 1-based inclusive end coordinate
step=1, # step as in range(start, end, step) - default: 1
min_mapq=0, # minimum mapping quality - default 0
min_bq=13, # minimum base quality - default 13 (as in samtools mpileup)
max_depth=8000, # maximum depth to return per base position
num_threads=12, # number of threads for parallelization
)
print(positions[:5]) # e.g. [100000, 100010, 100020, 100030, 100040]
print(depths[:5]) # e.g. [12, 15, 10, 8, 20]
CLI (Command Line Interface)
Coming soon! 🚀
🔥 Features
✅ Fast: Uses Rust’s efficient rust-htslib for BAM processing.
✅ Python bindings: Seamless integration with Python via pyo3.
✅ Custom filtering: Supports read quality (-q), base quality (-Q), and max depth (-d).
✅ Supports large BAM files: Uses IndexedReader for efficient region querying.
📜 License
rustbam is released under the MIT License. See LICENSE for details.
🤝 Contributing
- Fork the repo on GitHub.
- Create a new branch:
git checkout -b feature-new - Commit your changes:
git commit -m "Add new feature" - Push to your branch:
git push origin feature-new - Open a Pull Request 🎉
🌍 Acknowledgments
Built using rust-htslib and pyo3.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rustbam-0.1.5-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: rustbam-0.1.5-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.1 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd2c556bf7d9c3250fe70cf02d390e6caf34bd28d52a455c282646bbb623cb31
|
|
| MD5 |
df13ce062674831b6d0f3390875bf412
|
|
| BLAKE2b-256 |
fceef0d8b27f79a1b68048b49c86614d95767fa3ff356a1053bb70bb6c68d7eb
|