A GPU-accelerated Hi-C chromatin contact map. The matrix is normalized to an
8-bit texture and drawn as one WebGL quad (via regl), with the colormap
applied in the fragment shader, so pan/zoom stays smooth on very large
matrices. A precomputed level-of-detail pyramid keeps interaction fast when
zoomed out. Axes (genomic coordinate ticks) and the colorbar are drawn as
crisp vector overlays. No tile server is required.
Arguments
- mat
Either a square numeric matrix of contact counts, or a data frame / list giving a sparse COO triplet with integer columns
i,jand a numericv. When a triplet is supplied,nmust be given (or inferable frommax(i, j) + 1).- n
Number of bins per axis. Required for the sparse (i/j/v) form; ignored for a dense matrix (taken from
nrow(mat)).- bin_size
Genomic bin size in base pairs, a positive number; used to label axes in bp/kb/Mb.
NULL(orNA) labels axes by bin index.- chrom
Optional chromosome name shown as the axis title.
- colormap
Colormap for intensity: sequential
"viridis"(the default) or"ltc"(an earthy teal to sand to rust ramp), or diverging"rdbu"or"ltcdiv"(its counterpart, neutral cream at the midpoint).- transform
Intensity transform,
"log"(default) or"linear".- vmax
Upper clip of the intensity scale: a finite number greater than
vmin, and greater than 0 with the log transform.NULL(orNA) auto-picks a high percentile.- vmax_percentile
Percentile in
(0, 1]used to auto-pickvmaxwhenvmaxisNULL.NULL(orNA) uses the component default.- vmin
Lower clip of the intensity scale, a finite number.
NULL(orNA) uses 0. With the log transform, or whenvminis 0 or more, values at or below it are drawn as background. With the linear transform and a negativevmin(for example observed/expected log2 ratios), values below it take the lowest color.- symmetric
Mirror sparse
i/j/ventries across the diagonal:TRUEorFALSE.- label
Axis title (overrides
chromwhen set).- theme
Optional named list of theme overrides (colors, fonts, ...) merged over the component defaults in the browser.
NULLuses the default theme. Itspaddingentry is the space in px between the edge of the widget and the plot: one number for every side, or numbers namedtop,right,bottomandleftin a list or vector, a side left out keeping the default of 10. A colour given as a CSS custom property, such asbackground = "var(--bg)", takes the value the page gives it when the plot draws. After the page changes the property, what the plot drew on a canvas keeps the old colour until it draws again: resize the widget or render it again.- width, height
Widget dimensions (any valid CSS size).
- element_id
Optional explicit DOM id.