Adjacency-constrained hierarchical clustering of a band similarity\n matrix with application to Genomics

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

Abstract

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 are allowed to be merged. A major practical drawback of this method is its quadratic time and space complexity. By assuming that the similarity between physically distant objects is negligible, we propose an implementation of this adjacency-constrained HAC with quasi-linear complexity. Our illustrations on GWAS and Hi-C datasets demonstrate the relevance of this assumption and show that this method highlights biologically meaningful signals.

Introduction

In modern genomics, researchers frequently need to partition linear chromosomes into functional blocks. Examples include Linkage Disequilibrium (LD) blocks in GWAS or Topologically Associating Domains (TADs) in Hi-C contact maps. Hierarchical Agglomerative Clustering (HAC) with an adjacency constraint—where only neighboring clusters can merge—is a natural fit for this task. However, standard implementations suffer from $O(p^2)$ complexity, making them impractical for datasets with $10^4$ to $10^5$ loci where the number of potential similarity calculations can reach billions.

Methods: Breaking the Quadratic Bottleneck

The proposed approach achieves quasi-linear complexity through three primary innovations:

1. The Band Similarity Assumption

The authors assume that the similarity between two loci is negligible if they are separated by more than a bandwidth $h$. This transforms the dense $p \times p$ similarity matrix into a sparse band matrix, reducing space complexity to $O(ph)$.

Geometric representation of the banded similarity matrix and the regions used for efficient merge cost calculation.

2. The "Pencil Trick"

To compute Ward’s linkage efficiently within this band, the authors developed a recursive strategy. By pre-calculating sums of similarities in specific "pencil-shaped" regions (as seen in the figure above), the cost of any potential merge can be calculated in constant $O(1)$ time. This avoids re-scanning the matrix at every step of the hierarchy.

3. Min-Heap Optimization

Instead of a linear search for the best merge at each step, the algorithm utilizes a min-heap to store and retrieve candidate merges. This reduces the search time from $O(p)$ to $O(\log p)$, which is critical for maintaining performance as the number of loci increases.

Complexity comparison of different data structures for managing candidate merges, highlighting the efficiency of the Min-Heap.

Results and Validation

The method was tested on GWAS and Hi-C datasets, demonstrating significant performance gains without sacrificing biological accuracy.

  • Computational Efficiency: For a chromosome with ~23,000 SNPs, the adjclust package completed the task in 20 seconds (with $h=1000$), compared to over 5 hours for standard $O(p^2)$ implementations. The complexity scales as $O(p(h + \log p))$.
  • Memory Footprint: Memory usage for a large human ESC chromosome dropped by a factor of 10 (from 231 Mb to 23 Mb) due to the sparse representation.
  • Biological Relevance: Clusters identified in Hi-C data showed high enrichment for CTCF binding sites (proteins that help organize DNA loops), confirming that the "banded" approximation preserves essential biological structures.

Conclusion

By leveraging the inherent locality of genomic interactions, the adjclust method provides a scalable solution for high-resolution chromosome partitioning. The implementation is available as an R package on CRAN, enabling researchers to perform complex genomic clustering on standard hardware in seconds rather than hours.

Summary updated

Abstract

Motivation: Genomic data analyses such as Genome-Wide Association Studies\n(GWAS) or Hi-C studies are often faced with the problem of partitioning\nchromosomes into successive regions based on a similarity matrix of\nhigh-resolution, locus-level measurements. An intuitive way of doing this is to\nperform a modified Hierarchical Agglomerative Clustering (HAC), where only\nadjacent clusters (according to the ordering of positions within a chromosome)\nare allowed to be merged. A major practical drawback of this method is its\nquadratic time and space complexity in the number of loci, which is typically\nof the order of 10^4 to 10^5 for each chromosome. Results: By assuming that the\nsimilarity between physically distant objects is negligible, we propose an\nimplementation of this adjacency-constrained HAC with quasi-linear complexity.\nOur illustrations on GWAS and Hi-C datasets demonstrate the relevance of this\nassumption, and show that this method highlights biologically meaningful\nsignals. Thanks to its small time and memory footprint, the method can be run\non a standard laptop in minutes or even seconds. Availability and\nImplementation: Software and sample data are available as an R package,\nadjclust, that can be downloaded from the Comprehensive R Archive Network\n(CRAN).\n
BibTeX
@article{ambroise2019adjacency,
  author = {Christophe Ambroise and Alia Dehman and Pierre Neuvial and Guillem Rigaill and Nathalie Vialaneix},
  title = {{Adjacency-constrained hierarchical clustering of a band similarity\textbackslash\{\}n matrix with application to Genomics}},
  journal = {Algorithms Mol. Biol.},
  year = {2019},
  doi = {10.1186/s13015-019-0157-4},
}
Figure