noodles_tabix/
lib.rs

1#![warn(missing_docs)]
2
3//! **noodles-tabix** handles the reading and writing of the [tabix format].
4//!
5//! A tabix (TBI) is an index file typically used to allow random access of an accompanied file
6//! that is
7//!
8//!   1) bgzipped,
9//!   2) tab-delimited,
10//!   3) grouped by reference sequence name, and
11//!   4) coordinate sorted by start position.
12//!
13//! It can be used to find relevant records for a given genomic region.
14//!
15//! [tabix format]: https://samtools.github.io/hts-specs/tabix.pdf
16//!
17//! # Examples
18//!
19//! ## Read a tabix file
20//!
21//! ```no_run
22//! use noodles_tabix as tabix;
23//! let index = tabix::fs::read("sample.vcf.gz.tbi")?;
24//! # Ok::<(), std::io::Error>(())
25//! ```
26
27#[cfg(feature = "async")]
28pub mod r#async;
29
30pub mod fs;
31pub mod index;
32pub mod io;
33
34#[deprecated(since = "0.48.0", note = "Use `tabix::fs::read` instead.")]
35pub use self::fs::read;
36
37#[deprecated(since = "0.48.0", note = "Use `tabix::fs::write` instead.")]
38pub use self::fs::write;
39
40#[deprecated(since = "0.45.0", note = "Use `noodles_tabix::io::Reader` instead.")]
41pub use self::io::Reader;
42
43#[deprecated(since = "0.45.0", note = "Use `noodles_tabix::io::Writer` instead.")]
44pub use self::io::Writer;
45
46#[cfg(feature = "async")]
47#[deprecated(
48    since = "0.45.0",
49    note = "Use `noodles_tabix::r#async::io::Reader` instead."
50)]
51pub use self::r#async::Reader as AsyncReader;
52
53#[cfg(feature = "async")]
54#[deprecated(
55    since = "0.45.0",
56    note = "Use `noodles_tabix::r#async::io::Writer` instead."
57)]
58pub use self::r#async::Writer as AsyncWriter;
59
60use noodles_csi::binning_index::{self, index::reference_sequence::index::LinearIndex};
61
62const MAGIC_NUMBER: [u8; 4] = *b"TBI\x01";
63
64/// A tabix index.
65pub type Index = binning_index::Index<LinearIndex>;