Hilbert curve is a type of space-filling curves that fold one dimensional axis into a two dimensional space, but with still keeping the locality. It has advantages to visualize data with long axis in following two aspects:
- greatly improve resolution for the visualization;
- easy to visualize clusters because generally data points in the cluster will also be close in the Hilbert curve.
This package aims to provide an easy and flexible way to visualize data through Hilbert curve. The implementation and example figures are based on following sources:
Zuguang Gu, Roland Eils, and Matthias Schlesner, HilbertCurve: an R/Bioconductor package for high-resolution visualization of genomic data. Bioinformatics 2016
The package is at Bioconductor now and you can install the newest version by:
library(devtools) install_github("jokergoo/ComplexHeatmap") # in order to get the newest version of ComplexHeatmap install_github("jokergoo/HilbertCurve")
Basically, there are two steps to make a Hilbert curve.
- Initialize the curve and also map the one-dimensional axis to the curve.
- add low-level graphics by
hc_segments(), ... by giving the positions of the graphics.
hc = HilbertCurve(1, 100, level = 4) hc_points(hc, ...) hc_segments(hc, ...) hc_rect(hc, ...) hc_text(hc, ...)
There is another 'pixel' mode which provides a high resolution for visualizing genomic data by the Hilbert curve.
hc = HilbertCurve(1, 100000000000, level = 10) hc_layer(hc, ...) # this can be repeated several times to add multiple layers on the curve hc_png(hc, ...)
Rainbow color spectrum:
GC percent and genes on chromosome 1:
Association between H3K36me3 histone modification and gene bodies:
Methylation on chromosome 1:
Copy number alterations in 22 chromosomes:
GPL (>= 2)