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:

  1. a magic number,
  2. a list of reference sequences,
  3. 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()?;

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.