Inferensys

Glossary

Cooler File Format

A scalable, chunked data format for storing very large, sparse genomic interaction matrices, enabling efficient random access and out-of-core computation for deep learning pipelines.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
SCALABLE GENOMIC MATRIX STORAGE

What is Cooler File Format?

A self-describing, chunked binary format for storing massive, sparse genomic interaction matrices, enabling performant random access and out-of-core computation.

The Cooler file format is a data model and Python library implementing a chunked, multidimensional array storage scheme based on HDF5, specifically designed for very large, sparse genomic interaction matrices such as Hi-C contact maps. It enables efficient, random access to arbitrary subsets of a matrix without loading the entire dataset into memory, a critical capability for deep learning pipelines that require on-the-fly sampling of genomic contacts.

By partitioning the genome into fixed-size bins and storing interaction counts in a sparse, hierarchical layout, Cooler supports out-of-core computation on datasets that far exceed available RAM. It enforces a strict, self-describing schema that includes genomic coordinate indexes, normalization vectors, and metadata, ensuring interoperability between tools like cooltools and HiGlass while serving as the canonical input format for training sequence-to-contact prediction models.

SCALABLE GENOMIC STORAGE

Key Features of the Cooler Format

Cooler is a chunked, sparse data format designed for storing massive genomic interaction matrices. It enables efficient random access and out-of-core computation, making it essential for deep learning pipelines that process Hi-C contact maps.

01

HDF5-Based Chunked Storage

Cooler stores sparse genomic interaction matrices in an HDF5 container using a chunked, columnar layout. This design allows for efficient random access to arbitrary sub-matrices without loading the entire dataset into memory. The chunking strategy partitions the genome into fixed-size bins, enabling out-of-core computation for datasets that exceed available RAM. Each chunk is independently compressed, balancing I/O throughput with storage efficiency.

TB-scale
Maximum Dataset Size
02

Multi-Resolution Pixel Aggregation

Cooler supports multi-resolution contact matrices through a recursive pixel aggregation scheme. Starting from a base resolution (e.g., 1 kb), coarser resolutions are generated by summing contacts within larger bins. This hierarchical structure enables zoomable analysis, where users can query low-resolution genome-wide views or high-resolution locus-specific interactions. The aggregation preserves the sparse representation at each level, avoiding the storage explosion of dense matrices.

03

Range Queries and Strided Access

The format provides an API for range queries that retrieve contact frequencies between two genomic intervals. Using the matrix() method, users can extract sub-matrices by specifying chromosome coordinates and resolution. Strided access allows sampling every nth bin, useful for downsampling or generating training batches for deep learning models. The query engine leverages the chunk index to minimize disk reads, achieving sub-second retrieval for targeted regions.

04

Genome Assembly Anchoring

Cooler files are anchored to a reference genome assembly via an embedded chromosome table. This table maps chromosome names to their lengths and ordering, ensuring that matrix coordinates correspond to actual genomic positions. The anchoring enables cross-dataset comparisons by aligning contact maps from different experiments to the same coordinate system. It also supports assembly-aware normalization, where bin-level biases are stored alongside the interaction data.

05

Pixel Value Normalization Storage

Cooler stores both raw contact counts and normalized interaction frequencies in separate matrices within the same file. Normalization vectors, such as iterative correction weights or distance-expected values, are stored as 1D arrays alongside the 2D pixel data. This design allows users to toggle between raw and normalized views without recomputing corrections. The balanced matrix representation is critical for training deep learning models that require bias-corrected input features.

06

Streaming and Parallel I/O

The format supports streaming access for sequential processing of entire chromosomes, enabling memory-efficient training loops. Pixel data can be iterated in genomic order or matrix order, depending on the downstream algorithm. Cooler's HDF5 backend allows concurrent read access from multiple processes, facilitating parallel data loading in distributed training setups. Write operations are serialized to maintain data integrity during matrix construction.

COOLER FILE FORMAT

Frequently Asked Questions

Clear answers to common technical questions about the Cooler file format for storing and querying massive genomic interaction matrices.

The Cooler file format is a self-describing, chunked, columnar binary storage specification designed for very large, sparse genomic interaction matrices such as Hi-C contact maps. It implements a hierarchical data structure built on top of HDF5, where the interaction matrix is partitioned into fixed-size square blocks (pixels) and stored in a B-tree index. This architecture enables O(log N) random access to any submatrix without loading the entire dataset into memory. The format stores both the interaction counts and associated bin tables (genomic coordinates) in a single .cool file, making it fully portable and self-contained. Cooler supports multi-resolution storage through its companion mcool format, which stacks multiple matrix resolutions within one HDF5 group hierarchy, allowing users to seamlessly switch between coarse and fine-grained views of chromatin interactions.

GENOMIC DATA STORAGE COMPARISON

Cooler vs. Alternative Genomic Matrix Formats

Comparison of Cooler with alternative file formats for storing large, sparse genomic interaction matrices in deep learning pipelines.

FeatureCoolerHDF5/HierarchicalTabix-Indexed TextZarr

Chunked random access

Native sparse storage

Multi-resolution support

Columnar compression

Genomic coordinate awareness

Out-of-core computation

Standardized schema for Hi-C

Typical storage footprint (10B contacts)

~50 GB

~200 GB

~300 GB

~60 GB

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.