Metadata-Version: 2.4
Name: pybwa
Version: 2.3.0
Summary: Python bindings for BWA
License-Expression: MIT
License-File: LICENSE
Keywords: bioinformatics
Author: Nils Homer
Author-email: nils@fulcrumgenomics.com
Requires-Python: >=3.10.0,<4.0
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: fgpyo (>=0.7.0)
Requires-Dist: pysam (>=0.22.1)
Requires-Dist: typing_extensions (>=3.7.4) ; python_version < "3.13"
Description-Content-Type: text/markdown

[![Language][language-badge]][language-link]
[![Code Style][code-style-badge]][code-style-link]
[![Type Checked][type-checking-badge]][type-checking-link]
[![PEP8][pep-8-badge]][pep-8-link]
[![Code Coverage][code-coverage-badge]][code-coverage-link]
[![License][license-badge]][license-link]

---

[![Python package][python-package-badge]][python-package-link]
[![PyPI version][pypi-badge]][pypi-link]
[![PyPI download total][pypi-downloads-badge]][pypi-downloads-link]
[![Bioconda][bioconda-badge]][bioconda-link]
[![DOI][zenodo-badge]][zenodo-link]

---

[language-badge]:       http://img.shields.io/badge/language-python-brightgreen.svg
[language-link]:        http://www.python.org/
[code-style-badge]:     https://img.shields.io/badge/code%20style-black-000000.svg
[code-style-link]:      https://black.readthedocs.io/en/stable/
[type-checking-badge]:  http://www.mypy-lang.org/static/mypy_badge.svg
[type-checking-link]:   http://mypy-lang.org/
[pep-8-badge]:          https://img.shields.io/badge/code%20style-pep8-brightgreen.svg
[pep-8-link]:           https://www.python.org/dev/peps/pep-0008/
[code-coverage-badge]:  https://codecov.io/gh/fulcrumgenomics/pybwa/branch/main/graph/badge.svg
[code-coverage-link]:   https://codecov.io/gh/fulcrumgenomics/pybwa
[license-badge]:        http://img.shields.io/badge/license-MIT-blue.svg
[license-link]:         https://github.com/fulcrumgenomics/pybwa/blob/main/LICENSE
[python-package-badge]: https://github.com/fulcrumgenomics/pybwa/actions/workflows/tests.yml/badge.svg
[python-package-link]:  https://github.com/fulcrumgenomics/pybwa/actions/workflows/tests.yml
[pypi-badge]:           https://badge.fury.io/py/pybwa.svg
[pypi-link]:            https://pypi.python.org/pypi/pybwa
[pypi-downloads-badge]: https://img.shields.io/pypi/dm/pybwa
[pypi-downloads-link]:  https://pypi.python.org/pypi/pybwa
[bioconda-badge]:       https://img.shields.io/conda/dn/bioconda/pybwa.svg?label=Bioconda
[bioconda-link]:        http://bioconda.github.io/recipes/pybwa/README.html
[zenodo-badge]:         https://zenodo.org/badge/902029215.svg
[zenodo-link]:          https://doi.org/10.5281/zenodo.15029038
# pybwa

Python bindings for [bwa][bwa-link], the Burrows-Wheeler Aligner.
Pybwa provides native Python access to bwa's indexing and alignment algorithms, returning
[pysam][pysam-link] `AlignedSegment` objects for downstream analysis.

## Quick Start

### Align reads with `bwa mem`

`bwa mem` is the recommended algorithm for reads longer than ~70bp (Illumina, etc.).

```python
from pybwa import BwaMem

mem = BwaMem(prefix="/path/to/genome.fasta")
for recs in mem.align(queries=["CTCAAGGTTGTTGCAAGGGGGTCTATGTGAACAAA"]):
    for rec in recs:
        print(rec)
```

### Align short reads with `bwa aln`

`bwa aln` is designed for short reads (<100bp, e.g. Illumina).

```python
from pybwa import BwaAln

aln = BwaAln(prefix="/path/to/genome.fasta")
for rec in aln.align(queries=["GATTACA"]):
    print(rec)
```

### Reuse an index across aligners

Load a `BwaIndex` once and pass it to multiple aligners to avoid reloading:

```python
from pybwa import BwaIndex, BwaAln, BwaMem

index = BwaIndex(prefix="/path/to/genome.fasta")
aln = BwaAln(index=index)
mem = BwaMem(index=index)
```

## Installation

Install with `pip install pybwa` or `conda install -c bioconda pybwa`.

**Requires Python 3.10+**

## Documentation

See the full documentation on [pybwa.readthedocs.org][rtd-link].

---

<p>
<a href="https://fulcrumgenomics.com"><img src="logos/fulcrumgenomics.svg" alt="Fulcrum Genomics" height="100"/></a>
</p>

[Visit us at Fulcrum Genomics](https://www.fulcrumgenomics.com) to learn more about how we can power your Bioinformatics with pybwa and beyond.

<a href="mailto:contact@fulcrumgenomics.com?subject=[GitHub inquiry]"><img src="https://img.shields.io/badge/Email_us-brightgreen.svg?&style=for-the-badge&logo=gmail&logoColor=white"/></a>
<a href="https://www.fulcrumgenomics.com"><img src="https://img.shields.io/badge/Visit_Us-blue.svg?&style=for-the-badge&logo=wordpress&logoColor=white"/></a>

[rtd-link]: http://pybwa.readthedocs.org/en/stable
[bwa-link]: https://github.com/lh3/bwa
[pysam-link]: https://pysam.readthedocs.io/en/stable/

