pyramid: Plot a region as a pyramid

View source: R/pyramids.R

pyramidR Documentation

Plot a region as a pyramid

Description

Plots a region of the Hi-C map with a 45 degree rotation. The rotation makes it such that the diagonal coincides with the x-axis and the y-axis indicates distance. pyramid_difference() does the same, but first subtracts one sample from the other.

Usage

pyramid(
  exp,
  chrom,
  start,
  end,
  colour,
  crop_x,
  crop_y,
  display_yaxis,
  edge = "black",
  raw,
  ...
)

pyramid_difference(exp1, exp2, chrom, start, end, colour = NULL, ...)

Arguments

exp, exp1, exp2

A GENOVA contacts or contacts_matrix object.

chrom

One of the following:

  • A character of length one indicating a chromosome name.

  • A 3-column, 1-row data.frame in BED-format.

  • A single character describing a locus in UCSC notation, e.g. "chr1:30,000,000-40,000,000".

The latter two options automatically provide the start and end arguments too.

start, end

A numeric of length one for the start and end positions in basepairs.

colour

One of the following:

  • A numeric of length two giving the limits of the colour scale.

  • A continuous ggplot2 scale with a colour palette.

  • NULL for default scales, which is scale_fill_GENOVA() for single experiments or scale_fill_GENOVA_div() for pyramid_difference() or z-score normalised experiments.

crop_x, crop_y

A numeric of length two indicating positions in basepairs of where to crop the x- and y-axis respectively. For the y-axis, this means the distance from the diagonal in basepairs. Cropping the x-axis typically results in a house-shaped pentagon. Cropping the y-axis typically results in a trapezoid.

display_yaxis

A logical of length 1: should the y-axis be displayed?

edge

Draw an edge around the pyramid data region. One of the following:

  • A character of length 1 with a colour(name).

  • A gpar object describing graphical parameters for a line.

  • NULL to not draw an edge.

raw

A logical of length 1: should a bare bones plot be returned? When TRUE, no position- or colour-scales or theme elements are added.

...

Arguments passed to downstream functions.

Details

Some colour_scale settings are adjusted. If no limits were set, new limits are set as c(0, quantile(x, 0.975)), wherein x are the Hi-C values. Also, the oob parameter is replaced by scales::squish(), the name is set by default to "Contacts" and the aesthetics are ignored.

Value

A ggplot object

Annotations

For annotations along the linear genome, see pyramidtracks. For annotations in the Hi-C map, see add_tads and add_loops.

Note

To combine multiples of pyramid plots, we recommend to use the patchwork package available on CRAN.

See Also

Other matrix plots: compartment_matrixplot(), hic_matrixplot(), insulation_matrixplot(), trans_matrixplot()

Examples

## Not run: 
pyramid(exp, "chr2", 25e6, 30e6)

## End(Not run)

robinweide/GENOVA documentation built on March 14, 2024, 11:16 p.m.