70 breaking releases

new 0.71.0 Dec 12, 2024
0.70.0 Nov 7, 2024
0.69.0 Oct 22, 2024
0.65.0 Jul 14, 2024
0.2.1 Jul 30, 2021

#153 in Science

Download history 500/week @ 2024-08-22 816/week @ 2024-08-29 480/week @ 2024-09-05 431/week @ 2024-09-12 536/week @ 2024-09-19 691/week @ 2024-09-26 574/week @ 2024-10-03 1578/week @ 2024-10-10 708/week @ 2024-10-17 868/week @ 2024-10-24 741/week @ 2024-10-31 655/week @ 2024-11-07 438/week @ 2024-11-14 496/week @ 2024-11-21 594/week @ 2024-11-28 547/week @ 2024-12-05

2,129 downloads per month
Used in 43 crates (5 directly)

MIT license

1MB
27K SLoC

noodles-bam handles the reading and writing of the BAM (Binary Alignment/Map) file format.

The BAM format contains the same information as SAM (Sequence Alignment/Map), namely a SAM header and a list of records.

Examples

Read all records

use noodles_bam as bam;

let mut reader = bam::io::reader::Builder::default().build_from_path("sample.bam")?;
let header = reader.read_header()?;

for result in reader.records() {
    let record = result?;
    // ...
}

Query records

Querying allows filtering records by region. It requires an associated BAM index (BAI).

use noodles_bam as bam;

let mut reader = bam::io::indexed_reader::Builder::default().build_from_path("sample.bam")?;
let header = reader.read_header()?;

let region = "sq0:5-8".parse()?;
let query = reader.query(&header, &region)?;

for result in query {
    let record = result?;
    // ...
}

Dependencies

~2.9–9MB
~81K SLoC