gwseq-io 0.2.0

Rust library for processing bigWig, bigBed, BAM and HiC files
Documentation
//! bigWig and bigBed.
//!
//! The largest of the three formats, and the only one with both a reader and
//! a writer. Format reference: `docs/bbi_format.md`.
//!
//! Two splits worth naming:
//!
//! - `reader.rs` keeps the file, the headers, the zoom ladder and the request
//!   plumbing; the six extraction kernels move to `extract.rs`. Those are the
//!   hot loops and what the benchmarks measure.
//! - `rtree.rs` holds both directions of the R-tree, the read walk and the
//!   write. It is one format described twice, and every field name is shared.

// `pub(crate)` on the parser modules rather than private: `crate::fuzz`
// runs every one of them over hostile bytes, and it is a sibling of these
// rather than a descendant. Nothing here is re-exported, so the public API
// is what `pub use` below says it is.
pub(crate) mod block;
pub(crate) mod chr_tree;
mod convert;
mod extract;
/// Header structs and their magic numbers. Public so `sniff` can name the
/// byte-swapped forms it refuses.
pub mod header;
mod reader;
pub(crate) mod rtree;
mod section;
// Public because the Python layer's reprs spell their floats the same way;
// see `push_double`.
pub mod text;
mod writer;

pub use block::{BedEntry, DataInterval, ZoomRecord};
pub use convert::{convert_to_bigbed, convert_to_bigwig, ConvertResult, TextFormat};
pub use extract::{EntryWalk, EntryWindows, ValuesWalk, ValuesWindows, WindowLoc};
pub use header::{BbiHeader, BbiKind, TotalSummary, ZoomHeader};
pub use reader::{
    BbiReader, EntriesRequest, ProfileRequest, QuantifyRequest, ReadCommon, ValuesRequest, Zoom,
};
pub use section::{CostModel, SectionPolicy};
pub use writer::{BbiWriter, BbiWriterOptions, FieldType, SectionCounts};

/// `0x888FFC26`, little-endian.
pub const BIGWIG_MAGIC: u32 = 0x888F_FC26;
/// `0x8789F2EB`, little-endian.
pub const BIGBED_MAGIC: u32 = 0x8789_F2EB;

/// Items per data block. The UCSC writers' values.
pub const DEFAULT_ITEMS_PER_SLOT_BIGWIG: usize = 1024;
pub const DEFAULT_ITEMS_PER_SLOT_BIGBED: usize = 512;
/// R-tree branching factor.
pub const DEFAULT_BLOCK_SIZE: usize = 256;