It takes a named list with the DE data of different contrasts and draws an horizontal barplot with the up (right) and downregulated (left) genes.

barDEGs(
  deg_list,
  deg_names = names(deg_list),
  name_pos = "min",
  xlim = NULL,
  position_num = 10,
  xaxis = F,
  yaxis = F,
  colors = c("green", "red"),
  alpha = 0.5,
  num_size = 3,
  name_size = 3,
  log2FC = 1,
  pval = 0.05,
  total = FALSE,
  title = NULL,
  subtitle = NULL,
  prop_test = FALSE
)

Arguments

deg_list

Named list of dataframes with, at least, a column named DEG with the values 'Downregulated', "Upregulated" and "NS"

deg_names

Character vector of equal length to 'deg_list' names of the elements in 'deg_list'. Default: names(deg_list)

name_pos

Character of length 1. Where to write the name of each contrast. One of c('min', 'left', 'right', 'none'). If 'min', the name of the contrast will be written at the side where there are less DE genes; if 'right', the name of the contrast will be written to the right side of the plot; if 'left', the name of the contrast will be written to the left side of the plot; if 'none' the name of the contrast won't be written. Default: 'min'.

xlim

Numeric of length 2 or NULL. The limits of the X axis. If NULL, the limits of the X axis are the default. Useful when 'name_pos' is 'left' or 'right'. Default: NULL

position_num

Numeric of length 1. The position of the number of DEGs in each bar and the position of the contrast label. Default = 10.

xaxis

Logical of length 1. Whether to draw the text of the X axis (number of DE) or not. Default: FALSE.

yaxis

Logical of length 1. Whether to draw the text of the Y axis (contrast names) or not. Default: FALSE.

colors

Character of length 2. Colors for the downregulated and upregulated genes. Default: c("green", "red")

alpha

Numeric of length 1. Alpha (transparency) value for the vars. Deefault: 0.5.

num_size

Numeric of length 1. Size of the number of DEGs written in the bars. Default: 3.

name_size

Numeric of length 1. Size of the names of the contrasts written next to the bars. Default: 3.

log2FC

Numeric of length 1 or NULL. Threshold for the log2FoldChange to define a gene as differentially expressed. Default: 1.

pval

Numeric of length 1 or NULL. Threshold for the adjusted p-value to define a gene as differentially expressed. Default: 0.05.

total

Logical of length 1. If TRUE, it counts the total number of features in each elements of deg_list and writes them in the caption. Default: FALSE.

title

Charachter of length 1 or NULL. Title of the plot. Default: NULL.

subtitle

Charachter of lenght 1 or NULL. Subtitle of the plot. Default: NULL.

prop_test

Logical of length 1. Whether to do a prop.test() to check whether the proportions of up and downregulated genes are significantly different from the expected proportions of 0.5. Default: FALSE.

Value

A ggplot2-based barplot with the upregulated and downregulated genes in each contrast.

Author

amitjavilaventura