results_barplot {RQdeltaCT} | R Documentation |
results_barplot
Description
This function creates a barplot that illustrate mean and sd values of genes. Faceting and adding custom labels of statistical significance are available. This function is useful to present results for finally selected genes.
Usage
results_barplot(
data,
sel.Gene = "all",
bar.width = 0.8,
signif.show = FALSE,
signif.labels,
signif.length = 0.2,
signif.dist = 0.2,
faceting = FALSE,
facet.row,
facet.col,
y.exp.low = 0.1,
y.exp.up = 0.2,
angle = 0,
rotate = FALSE,
colors = c("#66c2a5", "#fc8d62"),
x.axis.title = "",
y.axis.title = "value",
axis.title.size = 11,
axis.text.size = 10,
legend.text.size = 11,
legend.title = "Group",
legend.title.size = 11,
legend.position = "top",
plot.title = "",
plot.title.size = 14,
save.to.tiff = FALSE,
dpi = 600,
width = 15,
height = 15,
name.tiff = "results_barplot"
)
Arguments
data |
Object returned from make_Ct_ready() or delta_Ct() functions. |
sel.Gene |
Character vector with names of genes to include, or "all" (default) to use all genes. |
bar.width |
Numeric: width of bars. |
signif.show |
Logical: if TRUE, labels for statistical significance will be added to the plot. Default to FALSE. |
signif.labels |
Character vector with statistical significance labels (e.g. "ns.","***", etc.). The number of elements must be equal to the number of genes used for plotting. All elements in the vector must be different; therefore, symmetrically white spaces to repeated labels must be add to the same labels, e.g. "ns.", " ns. ", " ns. ". |
signif.length |
Numeric: length of horizontal bars under statistical significance labels, values from 0 to 1. |
signif.dist |
Numeric: distance between errorbar and statistical significance labels. Can be in y axis units (if faceting = FALSE) or fraction of y axis value reached by errorbar (mean + sd value) (if faceting = TRUE). |
faceting |
Logical: if TRUE (default), plot will be drawn with facets with free scales. |
facet.row , facet.col |
Integer: number of rows and columns to arrange facets. |
y.exp.low , y.exp.up |
Numeric: space between data on the plot and lower or upper axis. Useful to add extra space for statistical significance labels when faceting = TRUE. |
angle |
Integer: value of angle in which names of genes are displayed. Default to 0. |
rotate |
Logical: if TRUE, boxplots will be arranged horizontally. Default to FALSE. |
colors |
Character vector length of one (when by.group = FALSE) or two (when by.group = TRUE), containing colors for groups. The numbers of colors must be equal to the number of groups. Default to c("#66c2a5", "#fc8d62"). |
x.axis.title |
Character: title of x axis. Default to "Gene". |
y.axis.title |
character: title of y axis. Default to "value". |
axis.title.size |
Integer: font size of axis titles. Default to 11. |
axis.text.size |
Integer: font size of axis text. Default to 10. |
legend.text.size |
Integer: font size of legend text. Default to 11. |
legend.title |
Character: title of legend. Default to "Group". |
legend.title.size |
Integer: font size of legend title. Default to 11. |
legend.position |
Position of the legend, can be "top" (default), "right", "bottom", "left", or "none" (no legend). See description for legend.position in ggplot2::theme() function. |
plot.title |
Character: title of plot. Default to "". |
plot.title.size |
Integer: font size of plot title. Default to 14. |
save.to.tiff |
Logical: if TRUE, plot will be saved as .tiff file. Default to FALSE. |
dpi |
Integer: resolution of saved .tiff file. Default to 600. |
width |
Numeric: width (in cm) of saved .tiff file. Default to 15. |
height |
Numeric: height (in cm) of saved .tiff file. Default to 15. |
name.tiff |
Character: name of saved .tiff file, without ".tiff" name of extension. Default to "results_barplot". |
Value
Object with plot. Created plot will be also displayed on graphic device.
Examples
library(ggsignif)
library(tidyverse)
data(data.Ct)
data.CtF <- filter_Ct(data.Ct,
remove.Gene = c("Gene2","Gene5","Gene6","Gene9","Gene11"),
remove.Sample = c("Control08","Control16","Control22"))
data.CtF.ready <- make_Ct_ready(data.CtF, imput.by.mean.within.groups = TRUE)
data.dCt <- delta_Ct(data.CtF.ready, ref = "Gene8")
data.dCtF <- filter_transformed_data(data.dCt, remove.Sample = c("Control11"))
results_barplot(data.dCtF,
sel.Gene = c("Gene1","Gene16","Gene19","Gene20"),
signif.labels = c("****","*","***"," * "),
angle = 30,
signif.dist = 1.05,
facet.row = 1,
facet.col = 4,
y.exp.up = 0.1,
y.axis.title = bquote(~2^-dCt))