Adjacency-constrained hierarchical clustering of a band similarity matrix with application to genomics

Christophe Ambroise, Alia Dehman, Pierre Neuvial, Guillem Rigaill, Nathalie Villa-Vialaneix

TL;DR

This paper introduces a significantly faster algorithm for hierarchical clustering of genomic data, specifically designed for large chromosomes. By assuming that similarity drops off with physical distance, they achieve near-linear time complexity, making previously intractable analyses feasible on standard hardware.

What Problem Does This Paper Address?

Genomic data, like that from Genome-Wide Association Studies (GWAS) or Hi-C experiments, often involves analyzing millions of data points (loci) along chromosomes. A common task is to partition these chromosomes into biologically meaningful regions. Hierarchical Agglomerative Clustering (HAC) is a natural approach, but a modified version that only merges adjacent clusters (respecting the linear order of loci) is more biologically relevant. However, the standard implementation of this adjacency-constrained HAC has a quadratic time and space complexity, making it too slow for the massive datasets generated by modern genomics.

Methods

The core innovation is an adjacency-constrained HAC algorithm that achieves quasi-linear time complexity. This is accomplished by:

  • Band Similarity Assumption: The key assumption is that the similarity between loci decreases rapidly with their physical distance. Specifically, they assume the similarity matrix is a "band matrix," meaning similarities are zero for loci separated by more than a certain distance h.
  • Pencil Trick: To efficiently compute the necessary similarity sums (required by Ward's linkage criterion) within this band assumption, they introduce a "pencil trick." This involves pre-calculating sums in specific "pencil-shaped" regions of the similarity matrix, allowing for constant-time linkage calculations.
  • Min-Heap for Fusions: Candidate fusions (potential merges of clusters) are stored and managed in a min-heap data structure. This allows for efficient retrieval of the best fusion at each step and efficient updates as clusters merge.

Datasets

The methods were evaluated on:

  • GWAS Data: A real-world dataset from a GWA study on HIV, using five different chromosomes with varying numbers of SNPs (from ~5,400 to ~23,300).
  • Hi-C Data: Data from experiments on mouse embryonic stem cells (mESC), human ESC (hESC), mouse cortex (mCortex), and human IMR90 Fibroblast (hIMR90). This data represents intra-chromosomal interactions.

Key Insights and Ideas

  • The "Band" Assumption is Powerful: The assumption that similarity drops off with distance isn't just a computational trick; it reflects biological reality and allows for massive speedups without sacrificing much accuracy.
  • Efficiency for Genomics: The proposed algorithm is orders of magnitude faster than existing methods, enabling analysis of entire chromosomes on a standard laptop in minutes or seconds, a feat previously impossible.
  • Biologically Meaningful Clusters: The method successfully identifies biologically relevant structures, such as Topological Domains (TADs) in Hi-C data and linkage disequilibrium blocks in GWAS.

Key Results

  • Speedup: For a chromosome with ~23,000 SNPs, the new adjclust package ran in ~20 seconds with a bandwidth h=1000, compared to over 5 hours for the existing rioja package. Even with h=p (no band approximation), adjclust was significantly faster.
  • Accuracy: The quality of the dendrograms produced by the band approximation (with h much smaller than p) was very high, often identical or extremely close to the results obtained with the full matrix (h=p). This suggests the speedup comes with minimal loss of information.
  • Biological Relevance: The clustering results on GWAS and Hi-C data were shown to highlight biologically meaningful signals, aligning with known structures like TADs and insulator binding sites.

Limitations and Future Work

  • Bandwidth Parameter (h): The primary tuning parameter is h, the bandwidth of the similarity band. While experiments suggest a range of h values yield similar results, a data-driven method for choosing h is suggested as future work.
  • Exploratory Analysis: While the method is excellent for exploratory data analysis, the authors suggest future work on using its efficiency for more rigorous inference on the estimated hierarchy, potentially using stability or resampling-based methods.

Summary updated

Abstract

Background Genomic data analyses such as Genome-Wide Association Studies (GWAS) or Hi-C studies are often faced with the problem of partitioning chromosomes into successive regions based on a similarity matrix of high-resolution, locus-level measurements. An intuitive way of doing this is to perform a modified Hierarchical Agglomerative Clustering (HAC), where only adjacent clusters (according to the ordering of positions within a chromosome) are allowed to be merged. But a major practical drawback of this method is its quadratic time and space complexity in the number of loci, which is typically of the order of $$10^4$$ 104 to $$10^5$$ 105 for each chromosome. Results By assuming that the similarity between physically distant objects is negligible, we are able to propose an implementation of adjacency-constrained HAC with quasi-linear complexity. This is achieved by pre-calculating specific sums of similarities, and storing candidate fusions in a min-heap. Our illustrations on GWAS and Hi-C datasets demonstrate the relevance of this assumption, and show that this method highlights biologically meaningful signals. Thanks to its small time and memory footprint, the method can be run on a standard laptop in minutes or even seconds. Availability and implementation Software and sample data are available as an R package, adjclust, that can be downloaded from the Comprehensive R Archive Network (CRAN).
BibTeX
@article{ambroise2019adjacency,
  author = {Christophe Ambroise and Alia Dehman and Pierre Neuvial and Guillem Rigaill and Nathalie Villa-Vialaneix},
  title = {{Adjacency-constrained hierarchical clustering of a band similarity matrix with application to genomics}},
  journal = {Algorithms Mol. Biol.},
  year = {2019},
  doi = {10.1186/s13015-019-0157-4},
}
Figure