Utilities for working with NGS index formats.


License
MIT
Install
pip install ngsindex==0.1.7

Documentation

ngsindex

Support for reading various NGS-related index formats:

Installation

pip install ngsindex

Usage

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