#noodles #bioinformatics #tabix

noodles-tabix

Tabix (TBI) format reader and writer

35 breaking releases

0.36.0 Jan 25, 2024
0.35.0 Dec 14, 2023
0.34.0 Nov 14, 2023
0.25.0 Jul 6, 2023
0.3.0 Jul 30, 2021

#22 in Biology

Download history 1111/week @ 2023-10-30 963/week @ 2023-11-06 885/week @ 2023-11-13 972/week @ 2023-11-20 1046/week @ 2023-11-27 567/week @ 2023-12-04 816/week @ 2023-12-11 627/week @ 2023-12-18 520/week @ 2023-12-25 469/week @ 2024-01-01 648/week @ 2024-01-08 546/week @ 2024-01-15 951/week @ 2024-01-22 748/week @ 2024-01-29 1005/week @ 2024-02-05 1065/week @ 2024-02-12

3,798 downloads per month
Used in 32 crates (5 directly)

MIT license

350KB
8K 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, enable the bam feature.

noodles = { version = "0.64.0", 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-tabix handles the reading and writing of the tabix format.

A tabix (TBI) is an index file typically used to allow random access of an accompanied file that is

  1. bgzipped,
  2. tab-delimited,
  3. grouped by reference sequence name, and
  4. coordinate sorted by start position.

It can be used to find relevant records for a given genomic region.

Examples

Read a tabix file

use noodles_tabix as tabix;
let index = tabix::read("sample.vcf.gz.tbi")?;

Dependencies

~1.6–3MB
~53K SLoC