Skip to main content

Utilities for working with NGS index formats.

Project description

# 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ngsindex, version 0.1.7
Filename, size File type Python version Upload date Hashes
Filename, size ngsindex-0.1.7.tar.gz (43.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page