69 breaking releases

0.70.0 Nov 7, 2024
0.68.0 Sep 26, 2024
0.65.0 Jul 14, 2024
0.58.0 Mar 28, 2024
0.2.1 Jul 30, 2021

#138 in Science

Download history 1309/week @ 2024-07-30 1191/week @ 2024-08-06 551/week @ 2024-08-13 907/week @ 2024-08-20 579/week @ 2024-08-27 817/week @ 2024-09-03 415/week @ 2024-09-10 365/week @ 2024-09-17 784/week @ 2024-09-24 521/week @ 2024-10-01 1576/week @ 2024-10-08 651/week @ 2024-10-15 867/week @ 2024-10-22 768/week @ 2024-10-29 766/week @ 2024-11-05 386/week @ 2024-11-12

2,847 downloads per month
Used in 42 crates (6 directly)

MIT license

1MB
26K 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.8–9MB
~80K SLoC