robinweide / GENOVA

GENome Organisation Visual Analytics
GNU General Public License v3.0
69 stars 15 forks source link

Pyramid annotations #210

Closed teunbrand closed 4 years ago

teunbrand commented 4 years ago

Pyramid plots now have an edge by default:

pyramid(exp, "chr1", 30e6, 40e6)

image

The edge follows cropping and is customisable:

pyramid(exp, "chr1", 30e6, 40e6, 
        crop_x = c(315e5, 385e5), crop_y = c(0, 5e6),
        edge = grid::gpar(col = "blue", lty = 2))

image

There are also classic CTCF site annotations:

p <- pyramid(exp, "chr1", 30e6, 40e6)
p + add_ctcf_sites(ctcf_bed, strand = ctcf_bed[, 4], size = 1)

image

Compartment scores, insulation scores and directionality indices can be displayed as tracks by adding them to the plot.

cs <- compartment_score(explist, bed = H3K4me1)
p + cs

image

You can exercise more precise control over them if you use as_track() on them:

p + as_track(cs, height = 0.2, geom = "line", linetype = 2)

image

Domainograms and virtual 4Cs are added as seperate tracks:

domain <- insulation_domainogram(explist, "chr1", 30e6, 40e6)
p + domain

image

You can add regular ggplot2 layers as long as some data value falls between the start and end of the pyramid plot:

x <- seq(20, 50, by = 0.1) * 1e6
df <- data.frame(
  x = x,
  ymin = cumsum(rnorm(length(x))),
  ymax = cumsum(rnorm(length(x)))
)
lay <- ggplot2::geom_ribbon(aes(x, ymin = ymin, ymax = ymax),
                            data = df)
p + as_track(lay, name = "ribbon")

image

Also, you can stack whatever annotations you want:

p + as_track(lay, name = "ribbon") + 
  domain + 
  add_ctcf_sites(ctcf_bed, strand = ctcf_bed[, 4], size = 1) +
  cs

image

The disappearing y-axis on the compartment score is currently a bug.

teunbrand commented 4 years ago

I think the check failed because of some pdf/latex/vignette stuff. @robinweide are you ok with merging this anyway?

robinweide commented 4 years ago

First of all, really nice work. It looks very tidy and I like the annotations. Seems like we now have two matrixplotters, which is not bad per se.

I think the check failed because of some pdf/latex/vignette stuff. @robinweide are you ok with merging this anyway?

No, we should fix it. The errors are all about this:

! Package pdftex.def Error: File `colour\T1\textunderscorehot.png' not found.

Let's try to find were you put underscores (or the colour "hot"). It would be ashame to have to ditch the travis-badge.

teunbrand commented 4 years ago

They are in man/figures/colour_hot.png, which I used in ?GENOVA_colours in colours.R. I made these so that the manual displays the colours, but I had to use markdown formatting for that doc to get these to work (which looks fine in the html docs). Perhaps we should revert to less fancy formatting and use branching logic instead, for example the one we use for the subscript '2' in log2: \ifelse{html}{\out{log<sub>2</sub>}}{\eqn{log_2}}