#noodles #sam #writer

noodles-sam

Sequence Alignment/Map (SAM) format reader and writer

75 breaking releases

new 0.76.0 May 16, 2025
0.74.0 Apr 6, 2025
0.73.0 Mar 8, 2025
0.68.0 Dec 20, 2024
0.2.0 Jul 30, 2021

#425 in Biology

Download history 598/week @ 2025-01-25 1372/week @ 2025-02-01 1073/week @ 2025-02-08 854/week @ 2025-02-15 1255/week @ 2025-02-22 1019/week @ 2025-03-01 1027/week @ 2025-03-08 1065/week @ 2025-03-15 690/week @ 2025-03-22 486/week @ 2025-03-29 851/week @ 2025-04-05 707/week @ 2025-04-12 505/week @ 2025-04-19 731/week @ 2025-04-26 653/week @ 2025-05-03 851/week @ 2025-05-10

2,788 downloads per month
Used in 50 crates (8 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.5–10MB
~91K SLoC