plot_multi: Plot multiple events or genes as a heatmap (experimental)

View source: R/plot_multi.R

plot_multiR Documentation

Plot multiple events or genes as a heatmap (experimental)

Description

Visualize multiple PSI or cRPKM values in a single plot.

Usage

plot_multi(df, config = NULL, subg = FALSE, expr = FALSE,
  trim_colnames = FALSE, qual = c("VLOW", "N", "LOW", "OK", "SOK"),
  counts = FALSE, xlab = "", ylab = "", title = "",
  cluster_rows = TRUE, cluster_cols = ifelse(is.null(config), TRUE,
  FALSE), fill = NULL, usepkg = c("ggplot2", "gplots", "pheatmap"),
  ...)

Arguments

df

A data frame of input values (PSI or cRPKM). If the latter, need to set expr = TRUE.

config

Optional configuration settings. Can be a path to the .config file, or 4/5-column data frame of the .config file.

subg

Logical indicating whether samples should be subgrouped for plotting.

expr

Logical - TRUE if plotting cRPKMs, FALSE otherwise

trim_colnames

String that must be searched for and trimmed at the end of every sample column in x. Useful to trim the "-cRPKM" suffix from expression tables. If no string must be trimmed, leave as FALSE.

qual

String indicating the minimun vast-tools quality score for the PSI to be accepted. Defaults to 'VLOW'. See the vast-tools documentation for details.

counts

Logical indicating whether the data frame contains read counts. Set to TRUE if the data frame contains two rows per sample (cRPKM and counts), otherwise leave as FALSE (default).

xlab

The x-axis label

ylab

The y-axis label

title

Title of the plot

cluster_rows

Logical to cluster rows using hierarchical clustering

cluster_cols

Logical to cluster columns using hierarchical clustering

fill

A vector of colours. e.g. from colorRampPalette. Default is NULL, which will choose the palette automatically.

usepkg

Default is ggplot2, which creates the heatmap using geom_tile. Otherwise, use gplots, which calls heatmap.2.

...

Additional parameters passed to heatmap.2 or pheatmap.

Details

By default, geom_tile is used to generate a heatmap and a ggplot2 object is returned. Alternatively, other heatmap packages are supported including: pheatmap (use usepkgs = "pheatmap") and heatmap.2 (use usepkgs = "gplots").

Input is similar to plot_event, plot_expr, or plot_multievent. Subgrouping of samples is also supported (see plot_event and preprocess_sample_colors for details on subgrouping). If subgroups are activated, the PSI for each subgroup is taken as the average of all the samples in the subgroup.

If cluster_rows = TRUE, then a hierarchical clustering using hclust will be performed on a distance matrix computed by dist. If config is not specified, then the samples will also be clustered.

To set the colours, use fill option to specify vector of colours. By default (fill=NULL), PSI uses a yellow/blue gradient, while cRPKMs uses the "YlOrRd" color brewer palette.

Examples

# Uses ggplot2 by default
plot_multi(psi)
plot_multi(psi, config = config)

# Use expr = TRUE for cRPKMs
plot_multi(crpkm, expr = TRUE)
plot_multi(crpkm, config = config, expr = TRUE)
plot_multi(crpkm, config = config, expr = TRUE, cluster_rows = TRUE)

# To use pheatmap or gplots for plotting, set usepgk option
plot_multi(psi, config = config, usepkg = "pheatmap")

# To enable sample subgroups, set subg = TRUE
plot_multi(psi, config = config, subg = TRUE)

# Working with expression tables with read counts and suffixes, enabling subgroups
plot_multi(crpkm_counts, config = config, expr = TRUE, trim_colnames = "-cRPKM", counts = TRUE)

kcha/psiplot documentation built on March 27, 2022, 4:20 a.m.