tornado_plot: Make a tornado plot

Description Usage Arguments Value Methods (by class) Examples

Description

The tornado_plot() function exists to easily jot down a tornado plot. The idea behind this function is that whenever you're in doubt on how to plot your tornado data, this is the function that tries to figure it out for you.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
tornado_plot(data, ...)

## S4 method for signature 'ANY'
tornado_plot(data, ...)

## S4 method for signature 'TornadoExperiment'
tornado_plot(data, ..., sort = NULL)

## S4 method for signature 'tornado_df'
tornado_plot(data, ...)

Arguments

data

A TornadoExperiment, tornado_df or other type of data forwarded to build_tornado().

...

Arguments passed on to build_tornado, prep_tornado, autoplot.tornado_df

features

A GRanges or GRangesList object containing genomic loci of interest.

width

An integer(1) in basepairs with respectively a common feature width to centre features in, a size of bins to summarise coverage in or the number of bins to summarise coverage in. Only two of these need to be defined.

binwidth

An integer(1) in basepairs with respectively a common feature width to centre features in, a size of bins to summarise coverage in or the number of bins to summarise coverage in. Only two of these need to be defined.

nbin

An integer(1) in basepairs with respectively a common feature width to centre features in, a size of bins to summarise coverage in or the number of bins to summarise coverage in. Only two of these need to be defined.

pad_value

A numeric(1) to use for padding when seqlenghts(features) are unknown or features exceed known sequence lengths.

assay_name

A character(1): one of the assay names retrieved by assayNames(tornado).

upper

Limits to the colour scale. Can be one of the following:

  • A numeric to set absolute limits directly.

  • A character in the form of a number prefixed by "p" or "q" to set the percentile or quantile respectively. For example, "p99" and "q0.95" set the limit to the 99th percentile or 0.95th quantile respectively. The limits as specified in the lower and upper arguments can be overridden if the scale argument has non-default limits.

lower

Limits to the colour scale. Can be one of the following:

  • A numeric to set absolute limits directly.

  • A character in the form of a number prefixed by "p" or "q" to set the percentile or quantile respectively. For example, "p99" and "q0.95" set the limit to the 99th percentile or 0.95th quantile respectively. The limits as specified in the lower and upper arguments can be overridden if the scale argument has non-default limits.

scale_title

A character(1) with the title for the colourbar. Can be overridden when the scale argument has a non-default name.

scale

A continuous fill scale from the ggplot2 package to use to colour the tornado. When NULL (default), the scale will be retrieved from the option "tornadoplot.default.scale".

facet

A logical(1) or ggplot2 facet. If TRUE, a facet_tornado() is added. If FALSE, no facet will be added. When a ggplot2 facet, the facet is added to the plot.

x_scale

A logical(1) or ggplot2 x scale. If TRUE, an x scale is added that attempts to avoid overlapping labels.

y_scale

A logical(1) or ggplot2 y scale. If TRUE, a y scale is added that marks regular intervals but only labels the number of features.

sort

A logical(1). Should the tornado be sorted from high to low? Does not apply for the tornado_df method.

Value

Prints a plot as a side effect. Returns a TornadoExperiment with the plot in the metadata() slot. When data is a tornado_df object, instead it returns the plot as-is.

Methods (by class)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# These features and data aren't really pretty
feats <- dummy_features()
data  <- dummy_granges_data()

# This will extract and plot the data. The extracted data is now stored in x.
x <- tornado_plot(data, features = feats, width = 3000)

# `x` is the data underlying the plot in an TornadoExperiment object.
print(x)

# The plot generated above is stored in the metadata
metadata(x)$plot

# Or the plot can be recomputed from the data
tornado_plot(x)

teunbrand/tornadoplot documentation built on Dec. 23, 2021, 8:48 a.m.