59 breaking releases

new 0.60.0 Apr 22, 2024
0.58.0 Mar 28, 2024
0.52.0 Dec 14, 2023
0.51.0 Nov 14, 2023
0.2.1 Jul 30, 2021

#137 in Science

Download history 269/week @ 2023-12-31 343/week @ 2024-01-07 141/week @ 2024-01-14 489/week @ 2024-01-21 425/week @ 2024-01-28 591/week @ 2024-02-04 530/week @ 2024-02-11 292/week @ 2024-02-18 802/week @ 2024-02-25 635/week @ 2024-03-03 869/week @ 2024-03-10 390/week @ 2024-03-17 421/week @ 2024-03-24 615/week @ 2024-03-31 343/week @ 2024-04-07 569/week @ 2024-04-14

1,979 downloads per month
Used in 31 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–5MB
~81K SLoC