plot_volcano_byvar_nvars: Generate a set of volcano plots of genes from a differential...

Description Usage Arguments

View source: R/plot_volcano_byvar_nvars.R

Description

Generate a set of volcano plots of genes from a differential expression (limma) analysis, for one or more contrasts, with point color or shape determined by a variable of interest. These plots can be output to plotting windows, or to pdfs. The points can be colored on a continuous or discrete scale, based on variables at the gene level. Points can also have shape determined by gene-level variables on a discrete scale. Points can be labeled with gene names, and the points to be labeled can be set based on an ellipse oriented to the x- and y-axes.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
plot_volcano_byvar_nvars(
     topGenes.pairwise, file_prefix=NULL, plotdims=c(9,9),
     fc_cut=log2(1.5), p_cut=0.01,
     color_by_var=NULL, color_by_var_levels=NULL, color_var_lab=NULL,
     my_cols=c("blue","red"), na_col="grey50",
     pch_by_var=NULL, pch_by_var_levels=NULL, pch_var_lab=NULL,
     my_pch=NULL,
     x_lim="auto", y_lim="auto",
     gene_labs=FALSE, x_cut=0, y_cut=0,
     point_order="random",
     ...)

Arguments

topGenes.pairwise

a list of data frames, each typically containing the output of a call to topTable for a single contrast. Each list element should be named with an identifier for the contrast, and must contain genes, log2 fold-change, and adjusted p-values. If plotting shapes or colors by a variable, each list element must contain a column matching that variable.

file_prefix

a character string. If provided, the function outputs pdfs of the plots, named "file_prefix.list_element_name.colored_by_color_by_var.shape_by_shape_by_var.pdf".

plotdims

a numeric vector, the size (in inches) of the plotting object. Either the size of the pdf, or the size of the plotting window.

fc_cut

numeric, the (absolute value) log2 fold-change threshold for determining significance of genes. This value is also plotted as vertical dotted lines. Setting to NULL removes the lines.

p_cut

numeric, the p-value threshold for determining significance of genes. This value is also plotted as a horizontal dotted line. Setting to NULL removes the lines.

color_by_var

(optional) character string or integer identifying the column in topGenes to color points by. If not provided, points are plotted in black.

color_by_var_levels

(optional) character vector defining the order of elements in the variable used for coloring points; this order is used for the plot legend and to match the order of colors (if provided). If not provided, levels are taken from the factor levels (if color_by_var is a factor), or else are ordered by order of appearance in topGenes.

color_var_lab

(optional) string to be used as the title for the color legends.

my_cols

(optional) vector of colors to use for plotting. If color_by_var is numeric, should have two elements, providing the start and end points for a continuous color scale (generated by scale_color_gradient). If color_by_var is not numeric, should be a vector with one color for each level of color_by_var; if the number of values supplied is less than the numer of levels in color_by_var, additional values are interpolated using colorRampPalette. By default, uses a range from blue to red.

na_col

color to use for NA values of color_by_var.

pch_by_var

(optional) character string or integer identifying the column in topGenes to vary point shapes by. If not provided, points are plotted as dots.

pch_by_var_levels

(optional) character vector defining the order of elements in the variable used for point shapes; this order is used for the plot legend and to match the order of shapes (if provided). If not provided, levels of the variable are ordered by order of appearance in topGenes.

pch_var_lab

(optional) string to be used as the title for the point shape legends.

my_pch

vector of shapes to use for plotting. Required if plotting points by shape; if not provided, all points will be plotted as dots. Must contain at least as many elements as the number of unique elements in pch_by_var.

x_lim, y_lim

either "auto", NULL, or numeric vectors. If "auto", x- and y-limits are determined from the data using get_xy_lims. If NULL, default plot limits are used. If provided as numeric vectors, the lower and upper limits of the plotting space along the x- and y-axes. Passed to ggplot2::xlim.

gene_labs

logical, whether to include gene labels for genes with extreme logFC and p-value. If TRUE, genes with values outside the labeling ellipse will be labeled.

x_cut, y_cut

numeric, the radii of the labeling ellipse along the x- and y-axes. Genes with values outside the ellipse are labeled with gene names. Default to 0, which results in all genes being labeled.

point_order

character string, specifying how to order the points. Currently accepted values are "random", which randomizes the order of the points, and "input", which sends the points to ggplot as they are in the input data frame. Defaults to "random".

...

additional parameters passed to pdf.


BenaroyaResearch/limmaTools documentation built on Dec. 17, 2021, 10:49 a.m.