31 breaking releases

new 0.32.0 May 16, 2024
0.30.0 May 2, 2024
0.29.0 Mar 28, 2024
0.26.0 Dec 14, 2023
0.1.1 Jul 21, 2021

#103 in Biology

Download history 573/week @ 2024-01-24 238/week @ 2024-01-31 479/week @ 2024-02-07 409/week @ 2024-02-14 479/week @ 2024-02-21 676/week @ 2024-02-28 750/week @ 2024-03-06 552/week @ 2024-03-13 331/week @ 2024-03-20 563/week @ 2024-03-27 306/week @ 2024-04-03 359/week @ 2024-04-10 527/week @ 2024-04-17 246/week @ 2024-04-24 534/week @ 2024-05-01 232/week @ 2024-05-08

1,570 downloads per month
Used in 19 crates (3 directly)

MIT license

420KB
10K SLoC

noodles

crates.io Docs.rs CI status

noodles attempts to provide correct implementations of libraries for handling various bioinformatics file formats. It currently supports BAM 1.6, BCF 2.2, BED, BGZF, CRAM 3.0/3.1, CSI, FASTA, FASTQ, GFF3, GTF 2.2, htsget 1.3, refget 2.0, SAM 1.6, tabix, and VCF 4.3/4.4.

Usage

noodles is published on crates.io. Early versions can be used in projects, but keep in mind that the API is still considered experimental.

noodles is split into multiple crates by file format. For convenience, a top-level meta crate named noodles can be added to your project's dependency list; and formats, listed as features. For example, to work with the BAM format, add the noodles crate and enable the bam feature.

cargo add noodles --features bam

Each enabled feature can then be imported by its re-exported name, e.g.,

use noodles::bam;

Feature flags

Individual crates may have optional features that can be enabled using feature flags.

  • async: Enables asynchronous I/O with Tokio. (BAM, BCF, BGZF, CRAM, CSI, FASTA, FASTQ, SAM, tabix, and VCF)
  • libdeflate: Use libdeflate to encode and decode DEFLATE streams. (BGZF and CRAM)

Examples

Each crate may have its own examples directory, and all examples are runnable as an application. After cloning the repository, run cargo run --release --example for a list of available examples. Use the example name as the option argument and append program arguments to the command, e.g.,

cargo run --release --example bam_write > sample.bam
cargo run --release --example bam_read_header sample.bam

lib.rs:

noodles-gff handles the reading and writing of the GFF3 format.

GFF (Generic Feature Format) is a text-based format used to represent genomic features.

Examples

Read all records in a GFF3 file

use noodles_gff as gff;

let mut reader = File::open("annotations.gff3")
    .map(BufReader::new)
    .map(gff::Reader::new)?;

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

    println!(
        "{}\t{}\t{}",
        record.reference_sequence_name(),
        record.start(),
        record.end(),
    );
}

Dependencies

~2.2–4MB
~69K SLoC