Struct noodles::bam::bai::Reader [−][src]
pub struct Reader<R> { /* fields omitted */ }
Expand description
A BAM index (BAI) reader.
A BAM index has three top-level fields:
- a magic number,
- a list of reference sequences,
- and optionally, the number of unmapped reads in the associated BAM.
While these fields can be read individually, consider using super::read
to read the entire
index at once.
Examples
use noodles_bam::bai;
let mut reader = File::open("sample.bam.bai").map(bai::Reader::new)?;
reader.read_header()?;
let index = reader.read_index()?;
Implementations
Creates a BAM index reader.
Examples
use noodles_bam::bai;
let reader = File::open("sample.bam.bai").map(bai::Reader::new)?;
Reads the BAM index header.
The BAM index header is just the magic number of the file format.
The position of the stream is expected to be at the start.
Examples
use noodles_bam::bai;
let mut reader = File::open("sample.bam.bai").map(bai::Reader::new)?;
reader.read_header()?;
Reads the BAM index.
The position of the stream is expected to be directly after the header.
Examples
use noodles_bam::bai;
let mut reader = File::open("sample.bam.bai").map(bai::Reader::new)?;
reader.read_header()?;
let index = reader.read_index()?;