1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//!
//! # Library
//!
//! The `binseq` library provides efficient APIs for working with the [BINSEQ](https://www.biorxiv.org/content/10.1101/2025.04.08.647863v2) file format family:
//!
//! - **[`cbq`]** — the recommended variant: columnar, block-compressed, lossless by default
//! - **[`bq`]** and **[`vbq`]** — earlier variants, still fully supported
//! - [`BinseqRecord`], [`BinseqReader`], and [`BinseqWriter`] — variant-agnostic record, reader, and writer abstractions
//! - [`ParallelProcessor`] — parallel processing of records with arbitrary per-record logic
//! - [`Policy`] — configurable handling of invalid nucleotides when encoding BQ/VBQ (CBQ stores `N` natively)
//!
//! # Example: Parallel Processing
//!
//! ```
//! use binseq::Result;
//! use binseq::prelude::*;
//!
//! #[derive(Clone, Default)]
//! pub struct Processor {
//! // per-thread state
//! }
//!
//! impl ParallelProcessor for Processor {
//! fn process_record<B: BinseqRecord>(&mut self, record: B) -> Result<()> {
//! // per-record logic
//! Ok(())
//! }
//!
//! fn on_batch_complete(&mut self) -> Result<()> {
//! // per-batch logic (e.g. flush to a shared writer)
//! Ok(())
//! }
//! }
//!
//! fn main() -> Result<()> {
//! // any BINSEQ variant (*.cbq, *.bq, *.vbq); format is sniffed from content
//! let path = "./data/subset.cbq";
//!
//! let reader = BinseqReader::new(path)?;
//! let processor = Processor::default();
//!
//! // process records in parallel with 8 threads
//! reader.process_parallel(processor, 8)?;
//! Ok(())
//! }
//! ```
/// CBQ - columnar variable-length records, optional quality scores and headers
/// BQ - fixed-length records, no quality scores
/// VBQ - variable-length records, optional quality scores, compressed blocks
/// Shared nucleotide encoder for BQ/VBQ writers
/// Error definitions
/// Parallel processing
/// Invalid nucleotide policy
/// Record types and traits shared between BINSEQ variants
/// Commonly used types and traits
/// Write operations generic over the BINSEQ variant
/// Utilities for working with BINSEQ files
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
/// Re-export `bitnuc::BitSize`
pub use BitSize;
/// Default quality score for BINSEQ readers without quality scores
pub const DEFAULT_QUALITY_SCORE: u8 = b'?';