Plotting heatmaps from big matrices in R

In genomics, and in many other -omics or big data fields, we often try to plot big matrices. By big matrices, I mean matrices that have more columns and/or rows than pixels in your device. For example, if we have a 50 column-matrix with one line per gene (~20,000 lines), then there are likely more lines in this matrix than pixels in your screen - 1080 vertical pixels in an HD screen (unless you’re reading this in a fancy future of hyper high definition).

The shape of DNA

Graphical abstract: Molecular biologists and biochemists are quite sensitive on the topic of DNA representation. Many of them will be triggered when the looping of the DNA is misrepresented as a left-handed helix instead of a right-handed one (what we mean by that is that when one looks at DNA from ‘within’ the helix, they turn clock-wise as they get more distant). I am not quite offended by this mistake, as I hardly remember if (B-)DNA is right-handed or left-handed, and what right-handed and left-handed means in the context of an helix.

How to shuffle ties after a sort?

When sorting a large table according to a specific metric (let’s say gene expression value), it is frequent to have ties for certain values (for example, 0 expression values). In most version of sorting, the order of the ties is preserved by the sorting. For example, with the base function order: suppressPackageStartupMessages(library(tidyverse)) gene_exp <- tibble( gene_name = paste0("ENSG0", 1:9), exp = c(rbind(rnorm(4, mean = 2), c(0, 0, 0, 0)), 0) ) gene_exp ## # A tibble: 9 x 2 ## gene_name exp ## <chr> <dbl> ## 1 ENSG01 2.