It takes 3 data.frames with expression values regardless the strand, sense or antisense (i.e., featureCounts -s 0|1|2) and draws a heatmap with the expression values and an hotizontal barplot with the expression sense and antisense.

expressionHeatmapBar(
  expr,
  expr_sense,
  expr_antisense,
  cols = NULL,
  genes = NULL,
  hm_values = T,
  hm_value_round = 0,
  hm_value_size = 3,
  hm_value_color = "black",
  hm_legend_colors = c("white", "cornflowerblue"),
  hm_legend_limits = c(0, expr %>% dplyr::select(is.numeric) %>% max()),
  hm_legend_breaks = seq(hm_legend_limits[1], hm_legend_limits[2], 1e+05),
  hm_legend_title = "Counts",
  hm_legend_size = c(40, 7),
  bar_pos = "fill",
  bar_xlab = NULL,
  bar_colors = c("lightgreen", "lightpink"),
  combine_plots = T,
  plot_title = NULL
)

Arguments

expr

Dataframe with a Geneid column and expression values or NULL. Column names must be equal to 'expr_sense' and 'expr_antisense'.

expr_sense

Dataframe with a Geneid column and expression values . Column names must be equal to 'expr' and 'expr_antisense'.

expr_antisense

Dataframe with a Geneid column and expression values . Column names must be equal to 'expr' and 'expr_sense'.

cols

Character vector with the names of the columns to take into account (Geneid does not count) or NULL. If NULL, all columns are taken into account. Default: NULL

genes

Character vector with the names of the genes to take into account or NULL. If NULL, all genes are taken into account. Default: NULL

hm_values

Logical of length 1. If TRUE (the default), write the corresponding expression values in each cell of the heatmap

hm_value_round

Numerical of length 1. The number of decimals the expression values will be rounded to. Default: 0.

hm_value_size

Numerical of length 1. Size of the expression values written in the heatmap. Default: 3.

hm_value_color

Charachter of length 1. Color of the expression values written in the heatmap. Default: "black".

hm_legend_colors

Character of length 2. Colors for the lower and upper limits of the heatmap, respectively. Passed through scale_fill_gradient. Default: c("white", "cornflowerblue"),

hm_legend_limits

Numerical of length 2. Lower and upper limits of the heatmap, respectively. Passed through scale_fill_gradient. Default: c(0,1e6),

hm_legend_breaks

Numerical vector. Breaks shown in the legend of the heatmap. Passed through scale_fill_gradient. Default: seq(0,1e6, 1e5),

hm_legend_title

Character of length 1 or NULL. Title of the legend of the heatmap. Default: "Counts"

hm_legend_size

Numerical of length 2. Height and width (in mm) of the legend of the heatmap, respectively. Passed through scale_fill_gradient. Default: c(40, 7),

bar_pos

Character of length 1. Either "fill" or "stack", Position of the columns, passed through the argument position in ggplot2::geom_col(). Default: "fill".

bar_xlab

Character of length 1 or NULL. Title of the X axis of the barplot. Default: NULL

bar_colors

Character of length 2. Colors for the antisense and sense bars in the barplot. Default: c("green", "tomato")

combine_plots

Logical of length 1. If TRUE (the default), it combines the heatmap and the barplot using patchwork. If FALSE, it returns a list with the individual plots.

plot_title

Character of length 1 or NULL. Title of the plot. Only if combine_plots = T. Default: NULL.

Value

A patchwork combination of a ggplot-based heatmap and a ggplot-based barplot (or a list with the individual plots).

Author

amitjavilaventura