# this vignette is not created if HiTC is not installed
if (!require("HiTC", quietly = TRUE)) {
  knitr::opts_chunk$set(eval = FALSE)
}
## 
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:parallel':
## 
##     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
##     clusterExport, clusterMap, parApply, parCapply, parLapply,
##     parLapplyLB, parRapply, parSapply, parSapplyLB
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
## 
##     Filter, Find, Map, Position, Reduce, anyDuplicated, append,
##     as.data.frame, cbind, colMeans, colSums, colnames, do.call,
##     duplicated, eval, evalq, get, grep, grepl, intersect,
##     is.unsorted, lapply, lengths, mapply, match, mget, order,
##     paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans,
##     rowSums, rownames, sapply, setdiff, sort, table, tapply,
##     union, unique, unsplit, which, which.max, which.min
## 
## Attaching package: 'S4Vectors'
## The following object is masked from 'package:base':
## 
##     expand.grid

Introduction

Hi-C is a sequencing-based molecular assay designed to measure intra and interchromosomal interactions between the DNA molecule. In particular, the identification of Topologically-Associated Domains (TADs), that is, of regions of the genome in which physical interactions are frequent, provides insight into the three-dimensional organization of a genome [1].

Hi-C data are in the form of two-dimensional contact maps, i.e., matrices whose \(i,j\) entry quantifies the intensity of the physical interaction between two genome regions \(i\) and \(j\) at the DNA level. In this vignette, we demonstrate the use of adjclust::hicClust to perform adjacency-constrained hierarchical agglomerative clustering (HAC) of Hi-C contact maps. The output of this function is a dendrogram, which can be cut to identify TADs. The algorithm used for adjacency-constrained (HAC) is described in the third chapter of [2].

library("adjclust")

Loading and displaying a sample Hi-C contact map

The data set hic_imr90_40_XX is an object of class HTCexp which has been obtained from the HiTC package [3]. It is a contact map corresponding to chromosome X vs chromosome X.

load(system.file("extdata", "hic_imr90_40_XX.rda", package = "adjclust"))

Now we have a look at the data.

HiTC::mapC(hic_imr90_40_XX)

Using hicClust

hicClust operates directly on objects of class HTCexp

fit <- hicClust(hic_imr90_40_XX)
## Note: 1005 merges with non increasing heights.

It is also possible to work on binned data. Below we choose a bin size of \(5 \times 10^5\):

binned <- HiTC::binningC(hic_imr90_40_XX, binsize = 5e5)
HiTC::mapC(binned)

fitB <- hicClust(binned)
fitB
## 
## Call:
## adjClust(mat = x, type = "similarity", h = h)
## 
## Cluster method   : adjClust 
## Number of objects: 304

The output is of class chac. In particular, it can be plotted as a dendrogram silently relying on the function plot.dendrogram:

plot(fitB)
## Warning in plot.chac(fitB): 
## Detected reversals in dendrogram: mode = 'corrected', 'within-disp' or 'total-disp' might be more relevant.