Skip to main content

Bindings to bwa aligner

Project description

bwamem

Python bindings for the BWA-MEM aligner.

Installation

pip install bwamem

Usage

Build Index

from bwamem import BwaIndexer

indexer = BwaIndexer()
index_path = indexer.build_index('reference.fa')

Single-End Alignment

from bwamem import BwaAligner

aligner = BwaAligner('path/to/index')
alignments = aligner.align('ACGATCGCGATCGA')

for aln in alignments:
    print(f'{aln.ctg}:{aln.r_st} strand={aln.strand} mapq={aln.mapq}')

Paired-End Alignment

read1 = 'ACGATCGCGATCGA'
read2 = 'TTCGATCGATCGAT'

paired_alignments = aligner.align(read1, read2)

for pe_aln in paired_alignments:
    print(f'Insert size: {pe_aln.insert_size}, Proper pair: {pe_aln.is_proper_pair}')

Custom Options

# Specify alignment parameters
aligner = BwaAligner('path/to/index', options='-x ont2d -A 1 -B 0')

# Set custom insert size for paired-end reads
paired_alignments = aligner.align(read1, read2, insert_size=500, insert_std=50)

Alignment Attributes

Each Alignment object contains the following attributes:

Attribute Description
ctg Contig/reference name
r_st Reference start position (0-based)
r_en Reference end position (property)
strand Strand: +1 for forward, -1 for reverse
q_st, q_en Query start/end positions
mapq Mapping quality score
cigar CIGAR as list of [length, op] pairs
cigar_str CIGAR string (property)
NM Edit distance
score Alignment score
is_primary Primary alignment flag

Calculated properties (computed on demand): r_en, cigar_str, blen, mlen

CIGAR operations: 0=M (match), 1=I (insertion), 2=D (deletion), 3=N (skip), 4=S (soft-clip), 5=H (hard-clip)

PairedAlignment contains: read1, read2 (Alignment objects), is_proper_pair (bool), insert_size (int or None)

License

  • Python bindings: Mozilla Public License 2.0
  • BWA: GNU General Public License v3.0

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

bwamem-0.0.5.tar.gz (1.1 MB view details)

Uploaded Source

Built Distributions

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

bwamem-0.0.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (374.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

bwamem-0.0.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (374.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

bwamem-0.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (374.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

bwamem-0.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (374.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

File details

Details for the file bwamem-0.0.5.tar.gz.

File metadata

  • Download URL: bwamem-0.0.5.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bwamem-0.0.5.tar.gz
Algorithm Hash digest
SHA256 f37838789da1e23b3097a1832f84e315ced9029fc49286c44007c3f59be48538
MD5 ee52b7d74eb8a905b4cee3ff87a3f7ea
BLAKE2b-256 da9197875e4a7825876384d1613adc0532544a46430ea064048b6da2933c7afd

See more details on using hashes here.

Provenance

The following attestation bundles were made for bwamem-0.0.5.tar.gz:

Publisher: publish.yml on y9c/bwamem

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

File details

Details for the file bwamem-0.0.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bwamem-0.0.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3ef65a833b3fa905379a7f82749421624f84f6af51642630be26bc4f8a98371f
MD5 93a64c2c2dd115def919ec3295c058d8
BLAKE2b-256 b03520b4f1eb413788bb5e787b263be3f7f675e19b791c94629d0067c698a571

See more details on using hashes here.

Provenance

The following attestation bundles were made for bwamem-0.0.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on y9c/bwamem

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

File details

Details for the file bwamem-0.0.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bwamem-0.0.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7463f1ea7eb6b3409d4aceec2bca39d97cc6daf61a6d1050185f62972b56473e
MD5 da65b909447b2254c2842c9c5fee8289
BLAKE2b-256 b7c59d4faaf057bfdaf1c2b9a890d4f698b9ec1a780850c8ffda4b5ba4a8cb6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for bwamem-0.0.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on y9c/bwamem

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

File details

Details for the file bwamem-0.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bwamem-0.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bfcb70648a2c7fb03c2224a2f42e3c7eab8a61c0d80dce1448ca70da7c6daaa3
MD5 6c76097bd212a3d961e909ccd359baf3
BLAKE2b-256 e565ab32e5552e7df4fc4c822f7198be7ad60fcdcc0d68f60ecc85b9165a7a8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for bwamem-0.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on y9c/bwamem

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

File details

Details for the file bwamem-0.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bwamem-0.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6d2816425e286919713012fdf93a95b0e9d83c3e815add2c5b37ec563cbd2fbe
MD5 499aa08f9ea5ebdd18384ef9f24c51da
BLAKE2b-256 770218247dcbcb41c0917aa62f7e68f55cc6461bded7d35572aae20e06d56dbd

See more details on using hashes here.

Provenance

The following attestation bundles were made for bwamem-0.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on y9c/bwamem

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