#sam #noodles #parser #writer

noodles-sam

Sequence Alignment/Map (SAM) format reader and writer

72 breaking releases

0.73.0 Mar 8, 2025
0.71.0 Jan 24, 2025
0.68.0 Dec 20, 2024
0.66.0 Nov 7, 2024
0.2.0 Jul 30, 2021

#489 in Biology

Download history 1081/week @ 2024-12-08 891/week @ 2024-12-15 416/week @ 2024-12-22 213/week @ 2024-12-29 931/week @ 2025-01-05 896/week @ 2025-01-12 1239/week @ 2025-01-19 632/week @ 2025-01-26 1520/week @ 2025-02-02 938/week @ 2025-02-09 812/week @ 2025-02-16 1320/week @ 2025-02-23 1065/week @ 2025-03-02 1029/week @ 2025-03-09 931/week @ 2025-03-16 573/week @ 2025-03-23

3,739 downloads per month
Used in 49 crates (9 directly)

MIT license

1MB
19K SLoC

noodles-sam handles the reading and writing of the SAM (Sequence Alignment/Map) format.

SAM is a format typically used to store biological sequences, either mapped to a reference sequence or unmapped. It has two sections: a header and a list of records.

The header mostly holds meta information about the data: a header describing the file format version, reference sequences reads map to, read groups reads belong to, programs that previously manipulated the data, and free-form comments. The header is optional and may be empty.

Each record represents a read, a linear alignment of a segment. Records have fields describing how a read was mapped (or not) to a reference sequence.

Examples

Read all records from a file

use noodles_sam as sam;

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

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

Dependencies

~3–10MB
~92K SLoC