plot_read_counts: Plot read counts by library

View source: R/plot_read_counts.R

plot_read_countsR Documentation

Plot read counts by library

Description

Output plots of read counts by library, at coarse and fine scales. Libraries areordered by the total number of reads. These plots can optionally be output to pdfs by specifing file_prefix. The first plot shows all libraries, with a line at threshold_line million reads. The second plot zooms in on the n_lowcount libraries with the lowest counts.

Usage

plot_read_counts(
  metrics,
  file_prefix = NULL,
  plotdims = c(9, 6),
  threshold_line = 5,
  n_lowcount = 20,
  color_by_var = NULL,
  color_by_var_levels = NULL,
  color_var_lab = NULL,
  my_cols = c("red", "blue"),
  na_col = "grey50",
  id_col = "lib.id",
  total_reads_col = "fastq_total_reads"
)

Arguments

metrics

matrix or data frame containing values of metrics. Should have metrics in columns and libraries in rows.

file_prefix

a character string. If provided, the function outputs pdfs of the plots, named "file_prefix_plot_name.pdf". If not provided, the function prints to a plotting window.

plotdims

a numeric vector, the size (in inches) of the plotting object. Either the size of the pdfs, or the size of the plotting windows.

threshold_line

numeric, the values (in millions of reads) at which to plot a horizontal line.

n_lowcount

numeric, the number of libraries to include in the plot of low-count libraries

color_by_var

(optional) character string or integer identifying the column in metrics to color bars by. If not provided, bars are plotted in grey.

color_by_var_levels

(optional) character vector defining the order of elements in the variable used for coloring bars; this order is used for the plot legend and to match the order of colors (if provided). If not provided, levels are taken from the factor levels (if color_by_var is a factor), or else are ordered by order of appearance in metrics.

color_var_lab

(optional) string to be used as the title for the color legend.

my_cols

(optional) vector of colors to use for plotting. If color_by_var is not numeric, should be a vector with one color for each level of color_by_var; if the number of values supplied is less than the numer of levels in color_by_var, additional values are interpolated using colorRampPalette. By default, uses a range from blue to red. Future updates will handle numeric vectors for color_by_var, as follows. color_by_var is numeric, should have two elements, providing the start and end points for a continuous color scale (generated by scale_color_gradient).

na_col

color to use for NA values of color_by_var.

id_col

numeric or character, the number or name of the column containing the library identifiers. Used to plot identifiers of low-count libraries. Defaults to "lib.id".


BenaroyaResearch/RNAseQC documentation built on April 19, 2024, 7:38 p.m.