results_boxplot {RQdeltaCT}R Documentation

results_boxplot

Description

This function creates boxplot that illustrate distribution of data for selected genes. It is similar to control_boxplot_gene() function; however, some new options are added, including gene selection, faceting, adding mean labels to boxes, and adding statistical significance labels. This function can be used to present results for finally selected genes.

Usage

results_boxplot(
  data,
  coef = 1.5,
  sel.Gene = "all",
  by.group = TRUE,
  signif.show = FALSE,
  signif.labels,
  signif.length = 0.2,
  signif.dist = 0.2,
  faceting = TRUE,
  facet.row,
  facet.col,
  y.exp.low = 0.1,
  y.exp.up = 0.2,
  angle = 0,
  rotate = FALSE,
  add.mean = TRUE,
  add.mean.size = 2,
  add.mean.color = "black",
  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_boxplot"
)

Arguments

data

Object returned from make_Ct_ready() or delta_Ct() functions.

coef

Numeric: how many times of interquartile range should be used to determine range point for whiskers. Default to 1.5.

sel.Gene

Character vector with names of genes to include, or "all" (default) to use all genes.

by.group

Logical: if TRUE (default), distributions will be drawn by compared groups of samples.

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 the highest value and statistical significance labels. Can be in y axis units (if faceting = FALSE) or fraction of y axis value reached by the highest 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 and 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.

add.mean

Logical: if TRUE, mean points will be added to boxes as squares. Default to TRUE.

add.mean.size

Numeric: size of squares indicating means. Default to 2.

add.mean.color

Character: color of squares indicating means. Default to "black".

colors

Character vector length of one (when by.group = FALSE) or more (when by.group = TRUE), containing colors for groups. The number 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_boxplot".

Value

Object with plot. Created plot will be also displayed on the 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_boxplot(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))


[Package RQdeltaCT version 1.3.0 Index]