visualise: Visualise discoveries

View source: R/methods_visualise.R

visualiseR Documentation

Visualise discoveries

Description

Plot the results of discovery objects. By default contrasts one sample with the others.

Usage

visualise(discovery, ...)

## Default S3 method:
visualise(
  discovery,
  contrast,
  raw,
  title,
  colour_lim,
  colour_lim_contrast,
  ...
)

Arguments

discovery

A discovery object as returned by GENOVA analysis functions.

...

Further arguments specific to the discovery class. See the section extended arguments below.

contrast

An integer or character matching an experiment (name) of length 1, specifying which sample should be used to make a contrast with all other samples. Alternatively, set to NULL to not plot contrast panels. See also the show_single_contrast argument.

raw

A logical of length 1: should a bare bones plot be returned?

title

add a title

colour_lim, colour_lim_contrast

Indication of limits for the primary and secondary continuous colour scales respectively. One of:

  • NULL to have an educated quess for the scale.

  • A numeric vector of length two providing the limits of the scale. Use NA to refer to existing minima or maxima.

  • A function that accepts the existing (automatic) limits and returns new limits.

Details

The "diff" metric value creates contrast panels by subtracting the values of each sample by the values of the sample indicated by the 'contrast' argument. The "lfc" metric value creates contrast panels by dividing every samples' values by the sample indicated by the 'contrast' argument and then taking the base 2 logarithm of that division.

The 'raw = TRUE' argument allows custimisation of the plots. The returned plot will not have position- or fill-scales and no theme settings, which can be set freely afterwards to match personal aesthetic tastes. When 'raw = TRUE' and 'subtract' is not NULL, the fill scale of the contrast panels can be manipulated by setting the 'aesthetics = "altfill"' inside ggplot2's fill scale functions.

Extended arguments

APA, PE-SCAn, ATA, ARA & C-SCAn

metric

A character of length one: "diff" for difference by subtraction or "lfc" for log2 fold changes.

colour_lim, colour_lim_contrast

Indication of limits for the primary and secondary colour scale respectively. One of:

  • NULL to have an educated quess for the scale.

  • A numeric vector of length two providing the limits of the scale. Use NA to refer to existing minima or maxima.

  • A function that accepts the existing (automatic) limits and returns new limits.

mode

A character of length one indicating what type of result to plot. Either "signal" or "obsexp", referring to the slot in the discovery object. Applicatble to PE-SCAn, C-SCAn and ARA.

show_single_contrast

A logical of length 1; if FALSE (default), does not show contrasts when discovery describes one experiment. If TRUE, plots empty panel.

Compartment-, Insulation score & Directionality Index

chr

A character of length one with the chromosome name. Defaults to "chr1".

start, end

An integer of length one setting the start or end of the region to plot. If NULL (default), is set to -Inf and Inf respectively

Relative Contact Probability

metric

A character of length one. The choices are:

"smooth"

A log10-smoothed line (default)

"both"

Like "smooth", but also adds the raw binned distances as points.

"lfc"

Displays log2 fold change compared to the sample specified in the contrast argument.

flipFacet

A logical of length one. If the bedlist argument was provided to RCP(), combine all regions in one panel? Defaults to FALSE.

Virtual 4C

bins

An integer of length 1 with the number of bins to aggregate signal in. If NULL (the default), this is set to the number of Hi-C bins in the viewpoint's chromosome.

bedlist

Either a BED-formatted data.frame or a list thereof, indicating genomic intervals to annotate in the bottom margin of the plot.

extend_viewpoint

An integer of length one in basepairs indicating by how much to widen the viewpoint censor-box. Affects the scaling of the y-axis.

Saddle

chr

A character of length one with the chromosome name. Defaults to "all".

show_single_contrast

A logical of length 1; if FALSE (default), does not show contrasts when discovery describes one experiment. If TRUE, plots empty panel.

Intra-inter TAD

geom

One of the following length one characters:

"boxplot"

Display as boxplots.

"violin"

Display as violin plots.

"jitter"

Display as jittered points plot.

censor_contrast

A logical of length 1 deciding whether the contrasting experiment itself should be censored (TRUE) or included (FALSE).

Note

For ATA_discovery objects which include the matrix's diagonal, the upper limit for the contacts fill scale is set to the 95th percentile of the data to increase the dynamic range of colours. The same is true for ARA_discovery, when 'mode = "signal"'.

Examples

## Not run: 
# APA
apa <- APA(list(WT = WT_40kb, KO = KO_40kb), loops)
visualise(apa)

# PE-SCAn
pescan <- PESCAn(list(WT = WT_40kb, KO = KO_40kb), super_enhancers)
visualise(pescan)

# To plot PE-SCAn without background correction
visualise(pescan, mode = "signal")

# ATA
ata <- APA(list(WT = WT_10kb, KO = KO_10kb), tads)
visualise(ata)

# ARA
ara <- ARA(list(WT = WT_20kb, KO = KO_20kb), ctcf_sites)
visualise(ara)

# Compartment score
cs <- compartment_score(list(WT = WT_100kb, KO = KO_100kb), H3K4me1_peaks)
visualise(cs, chr = "chr1")

# Saddle function
sadl <- saddle(list(WT = WT_100kb, KO = KO_100kb), cs) # see example above
visualise(sadl)

# Handling 'raw' plots
visualise(pescan, raw = TRUE) +
  ggplot2::scale_fill_gradient(aesthetics = "altfill")

## End(Not run)

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