In standard bioinformatics, you read a file (Parser), parse it into an object (Domain), and run a method on the object (Algorithm). In BioZig (BZ), data is orthogonal to behavior. The parser generates raw Domain structs, and the Algorithms consume them. No objects own methods.
Parse a PDB file using zero-copy MMap, generate a Structure of Arrays (SoA) coordinate set, and compute its geometric centroid.
const std = @import("std");
const biozig = @import("biozig");
const structural = biozig.algorithms.structural;
const pdb = biozig.ingestion.structural.pdb;
pub fn main() !void {
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const allocator = arena.allocator();
// 1. Zero-copy ingest PDB using 64-bit Bit-Sieve
const coords = try pdb.parseCoordinateSet(allocator, "protein.pdb");
// 2. Compute centroid via SIMD vectorized loop
const centroid = structural.computeCentroid(coords);
std.debug.print("Centroid: X={d:.3}, Y={d:.3}, Z={d:.3}
", .{centroid.x, centroid.y, centroid.z});
}BZ's Python bindings expose C-ABI pointers. We can ingest a massive Matrix Market (.mtx) file and run a fast PCA directly in hardware memory without instantiating millions of Python objects.
import biozig as bz
# 1. Parse sparse single-cell expression data via zero-copy MTX reader
mtx_data = bz.transcriptomics.parse_mtx("cells.mtx")
# 2. Calculate top 10 principal components using the Analytics module
pca_results = bz.analytics.dimensionality.pca(mtx_data, n_components=10)
print(f"Explained Variance: {pca_results.explained_variance}")
print(f"Transform: {pca_results.transform}")In R, loading large network graphs often causes RAM exhaustion. BZ handles the graph traversal outside of the R garbage collector.
library(biozig)
# 1. Load systems network (e.g., from an edge list or BioPAX)
graph <- bz_systems_parse_edgelist("protein_network.txt")
# 2. Compute Louvain communities using the Graph builder
communities <- bz_systems_louvain(graph)
print(head(communities))The BZ CLI provides direct access to these pipelines from bash. Because the CLI is purely compiled Zig, execution is instantaneous.
# Compute GC Content and Shannon Entropy for a large genome FASTA
$ biozig genomics metrics --input human_genome.fasta --metrics gc_content,entropy
> GC Content: 41.2%
> Shannon Entropy: 1.98 bits