single_pair_gene {RQdeltaCT} | R Documentation |
single_pair_gene
Description
This function generates scatter plot with linear regression line for two specified genes.
Usage
single_pair_gene(
data,
x,
y,
by.group = TRUE,
point.size = 4,
point.shape = 19,
point.alpha = 0.7,
colors = c("#66c2a5", "#fc8d62"),
axis.title.size = 11,
axis.text.size = 10,
legend.title = "Group",
legend.title.size = 11,
legend.text.size = 11,
legend.position = "right",
plot.title = "",
plot.title.size = 14,
labels = TRUE,
label = c("eq", "R2", "p"),
label.position.x = c(1, 1),
label.position.y = c(1, 0.95),
small.p = FALSE,
small.r = FALSE,
p.digits = 3,
rr.digits = 2,
save.to.tiff = FALSE,
dpi = 600,
width = 15,
height = 15,
name.tiff = "_single_pair_plot"
)
Arguments
data |
Object returned from make_Ct_ready() or delta_Ct() functions. |
x , y |
Characters: names of genes to use. |
by.group |
Logical: if TRUE (default), relationships will be shown separately for compared groups. |
point.size |
Numeric: size of points. Default to 4. |
point.shape |
Integer: shape of points. Default to 19. |
point.alpha |
Numeric: transparency of points, a value between 0 and 1. Default to 0.7. |
colors |
Character vector containing colors for compared groups. The number of colors must be equal to the number of groups. Default to c("#66c2a5", "#fc8d62"). |
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.title |
Character: title of legend. Default to "Group". |
legend.title.size |
Integer: font size of legend title. Default to 11. |
legend.text.size |
Integer: font size of legend text. Default to 11. |
legend.position |
Position of the legend, can be "top", "right" (default), "bottom", "left", or "none" (no legend). See description for legend.position parameter in ggplot2::theme() function. |
plot.title |
Character: title of plot. Default to "". |
plot.title.size |
Integer: font size of plot title. Default to 14. |
labels |
Logical: if TRUE (default), a regression statistics will be added to the plot using ggpimsc::stat_poly_eq() function. |
label |
Character: specifies regression statistics to add, names specified by ggpimsc::stat_poly_eq() function must be used. Default to c("eq", "R2", "p") for regression equation, coefficient of determination and p value, respectively. |
label.position.x , label.position.y |
Numeric: coordinates for position of regression statistics. If by.group = TRUE, a vector length of groups number can be provided to avoid overlapping. See description of label.x and label.y parameters from ggpimsc::stat_poly_eq() function. |
small.p , small.r |
Logical, if TRUE, p character in p value label and r character in coefficient of determination label will be lowercase. Default to FALSE. |
rr.digits , p.digits |
Integer: number of digits after the decimal point in coefficient of determination and p value in labels. Default to 2 for rr.digits and 3 for p.digits. |
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 "Gene1_Gene2_single_pair_plot". |
Value
Object with plot. Created plot is also displayed on the graphic device.
Examples
library(tidyverse)
library(ggpmisc)
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")
single_pair_gene(data.dCt, "Gene16", "Gene17")