3
7
BIOZIG
BZ API Reference OFFICIAL DOCUMENTATION

Welcome to the official documentation for BZ. This manual covers the core concepts, memory architecture, and domain-specific APIs (Molecular, Structural, Cellular, Population, Genomics, Systems, and Evolutionary). BZ prioritizes Zero-Copy I/O, Structure of Arrays (SoA) layouts, and Explicit SIMD Vectorization.

Table of Contents

1. Core: Memory & I/O

BZ leverages Memory Mapped (mmap) files and @Vector primitives for Single Instruction, Multiple Data (SIMD) operations. Operations are chunked into vector lengths matching CPU architectures to eliminate byte-by-byte bottlenecks.

MMapReader
pub const MMapReader = struct { file: std.Io.File, mmap: std.Io.File.MemoryMap, data: []const u8 }
Maps files into memory without allocating strings. O(1) ingestion cost.

2. Ingestion: File Parsers

BZ implements 64-bit Bit-Sieve parsers for zero-copy file ingestion across a massive array of bioinformatics formats.

Supported Formats
Zero-copy parsing support via ingestion/
  • Genomics: FASTA, FASTQ, SAM, BAM, CRAM, VCF, BCF, BED, GFF3, GTF, 2bit, Genomic Indices
  • Structural: PDB, MMCIF, MOL2, PQR, SDF
  • Systems: SBML, BioPAX, GPML
  • Transcriptomics: MTX (Matrix Market), Sparse Matrices
  • Evolutionary: Newick, Nexus, PhyloXML
  • Compression: BGZF streaming

3. Analytics: Statistical & Matrix Operations

The analytics module sits between domains and algorithms, providing highly-optimized mathematical primitives, factorization, and machine-learning fundamentals.

Analytics Module Capabilities
pub const analytics = @import("analytics/analytics.zig");
  • Dimensionality Reduction: PCA, t-SNE, UMAP
  • Matrix Factorization: MDS, NMF, SVD, Sparse Matrices
  • Clustering: K-Means, DBSCAN, Hierarchical Clustering
  • Graph ML: Node2Vec, Spectral embeddings
  • Sequence Modeling: Markov Chains, K-mer Statistics
  • Pathways: Enrichment Analysis, SPIA (Signaling Pathway Impact Analysis)

4. Domain & Algorithms: Molecular & Genomics

Strict 2-bit packing for DNA strings, replacing garbage-collected characters with bitwise arithmetic.

Genomic Algorithms
Hardware accelerated counting and metrics
Algorithms supported: GC Content, Shannon Entropy, Hamming Distance, and vectorized mismatch detection using @popCount hardware instructions.

5. Domain & Algorithms: Structural

Structure of Arrays (SoA) memory layouts for 3D coordinate geometry to prevent cache misses during heavy floating-point operations.

Structural Algorithms
pub const CoordinateSet = struct { x: []f64, y: []f64, z: []f64 };
Algorithms supported: Kabsch Rotation, Optimal RMSD, Distance Matrices, Contact Maps, Hydrogen Bond Detection, Pocket Statistics, Radius of Gyration, Verlet Molecular Dynamics, Simulated Annealing, ANM Hessian Generation, Threading DP, and Greedy Sidechain Packing.

6. Domain & Algorithms: Cellular & Transcriptomics

Pipelines for single-cell transcriptomics matrices.

Cellular Algorithms
Sparse Matrix transforms
Algorithms supported: Pseudotime Inference, K-NN Graph Building, and seamless integration with UMAP/PCA analytics.

7. Domain & Algorithms: Systems & Pathways

Network and graph topologies built using high-performance adjacency lists and sparse matrices.

Systems Algorithms
Graph theory and traversals
Algorithms supported: BFS/DFS, Shortest Path, Dijkstra, Connected Components, Topological Sort, Closeness & Betweenness Centrality, PageRank, Louvain Community Detection, Edmonds-Karp Max Flow, Triangle Counting, and Fruchterman-Reingold Force-Directed Layouts.

8. Domain & Algorithms: Population & Evolutionary

From allele frequencies to phylogenetic trees, optimizing matrix multiplications and recursive tree structures.

Population & Evolutionary Algorithms
Phylogenetics and Associations
Algorithms supported: Linkage Disequilibrium (LD), GWAS Matrix Math. Phylogenetics: Robinson-Foulds Distance, Parsimony Fitch, UPGMA, Neighbor-Joining, Felsenstein Pruning, Nearest Neighbor Interchange (NNI), Subtree Pruning Regrafting (SPR), Felsenstein Bootstrapping, and Bayesian MCMC Inference.