Skip to main content
# ngsindex

Support for reading various NGS-related index formats:

* [BAI](https://samtools.github.io/hts-specs/SAMv1.pdf)
* [TBI](https://samtools.github.io/hts-specs/tabix.pdf)
* [CSI](https://samtools.github.io/hts-specs/CSIv2.pdf)

# Installation

```bash
pip install ngsindex
```

# Usage

```python
from ngsindex import IndexType, resolve_index_file, parse_index
from pathlib import Path

bam_file = Path('/path/to/reads.bam')

# Resolve the location of the BAM index file.
index_file = resolve_index_file(bam_file, IndexType.BAI)

# Load the index
index = parse_index(index_file)

# Loop through chromosome indexes
for refidx in index.ref_indexes:
...
```

# Limitations

* CRAM files are not yet supported (neither .crai nor .bai index files).

# Todo

* Add support for splitting BAI:
* https://github.com/samtools/hts-specs/pull/321
* https://github.com/tomwhite/hts-specs/blob/sbi/SAMv1.tex

Metadata

Release files for ngsindex 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ngsindex 0.1.7
File Size Uploaded Provenance Actions
ngsindex-0.1.7.tar.gz 43.3 kB Without provenance Details for ngsindex-0.1.7.tar.gz

Release files / ngsindex-0.1.7.tar.gz

Download URL ngsindex-0.1.7.tar.gz
Size 43.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8996c6e762df0814631e2e5f5b97733ebcf30cd7ac0884f149b6422a9a1eb38a
BLAKE2b-256 checksum
How to use checksums
32551838a41dda1d46e74319453f234354166164abcbcb9b0fe46a707c33cc29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.6

Security for ngsindex 0.1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page