53 breaking releases

new 0.54.0 Apr 22, 2024
0.52.0 Apr 4, 2024
0.51.0 Mar 28, 2024
0.48.0 Dec 14, 2023
0.2.0 Jul 30, 2021

#539 in Parser implementations

Download history 242/week @ 2024-01-01 361/week @ 2024-01-08 120/week @ 2024-01-15 650/week @ 2024-01-22 446/week @ 2024-01-29 672/week @ 2024-02-05 502/week @ 2024-02-12 347/week @ 2024-02-19 874/week @ 2024-02-26 636/week @ 2024-03-04 849/week @ 2024-03-11 522/week @ 2024-03-18 589/week @ 2024-03-25 608/week @ 2024-04-01 649/week @ 2024-04-08 695/week @ 2024-04-15

2,579 downloads per month
Used in 33 crates (9 directly)

MIT license

1MB
22K 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-vcf handles the reading and writing of the VCF format.

Examples

Read all records from a file

use noodles_vcf as vcf;

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

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

Dependencies

~1.8–3.5MB
~58K SLoC