Plot selected TSR metrics.

plot_tsr_metric(
  experiment,
  tsr_metrics,
  plot_type = "violin",
  samples = "all",
  log2_transform = FALSE,
  ncol = 1,
  use_normalized = FALSE,
  dominant = FALSE,
  threshold = NULL,
  data_conditions = NULL,
  ...
)

Arguments

experiment

TSRexploreR object.

tsr_metrics

Names of metrics in TSRexploreR to plot.

plot_type

Output a 'violin', 'jitter', 'box', or 'boxjitter' plot.

samples

A vector of sample names to analyze.

log2_transform

Whether the metric should be log2 + 1 transformed prior to plotting.

ncol

Integer specifying the number of columns to arrange multiple plots.

use_normalized

Whether to use the normalized (TRUE) or raw (FALSE) counts.

dominant

If TRUE, will only consider the highest-scoring TSS per gene, transcript, or TSR or highest-scoring TSR per gene or transcript.

threshold

TSSs or TSRs with a score below this value will not be considered.

data_conditions

Apply advanced conditions to the data.

...

Arguments passed to ggplot2 plotting functions.

Value

ggplot2 object with TSR matrix plotted.

Details

Plot any TSR metric contained within the counts data.table. Metrics can be supplied as a character vector to 'tsr_metrics', and will be optionally log2 transformed if 'log2_transform' is TRUE. Valid plot types that can be supplied to 'plot_type' are 'violin', 'box', 'jitter', and 'boxjitter' (a combination of boxplot and jitterplot).

A set of functions to control data structure for plotting are included. 'use_normalized' will use normalized scores, which only matters if 'consider_score' is TRUE. 'threshold' defines the minimum number of raw counts a TSS or TSR must have to be considered. dominant' specifies whether only the dominant TSS or TSR (determined using the 'mark_dominant' function) is considered. For TSSs, this can be either dominant TSS per TSR or gene/transcript, and for TSRs it is the dominant TSR per gene/transcript. 'data_conditions' can be used to filter, quantile, order, and/or group data for plotting.

See also

tsr_metrics to calculate additional TSR metrics.

Examples

data(TSSs_reduced) exp <- TSSs_reduced %>% tsr_explorer %>% format_counts(data_type="tss") %>% tss_clustering(threshold=3)
#> Warning: Arguments in '...' ignored
#> Warning: Arguments in '...' ignored
p <- plot_tsr_metric(exp, "width")