volcanoPlot: Deluxe Volcano Plots

Description Usage Arguments Details Value Author(s) Examples

View source: R/volcanoPlot.R

Description

A volcano plot shows Log Ratio data on the X axis and Negative Log Pvalues (NLP) on the Y axis. This function is intended to show the volcano plot from a dataframe created by topTable or topTreat. Properly normalized data will generally be centered around LogRatio = 0.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
volcanoPlot(
  df,
  logRatioCol = "logFC",
  logIntCol = "AveExpr",
  pvalCol = "P.Value",
  pthreshold = 0.01,
  geneSymLabels,
  geneSymCol,
  xlab = NULL,
  ylab = NULL,
  title = NULL,
  symbolSize = c(4, 3.999, 4),
  symbolShape = c(21, 1, 21),
  symbolColor = c("black", "grey25", "grey0"),
  symbolFill = c("red3", "grey25", "deepskyblue4"),
  alpha = 0.5,
  sizeByIntensity = TRUE,
  pthresholdLine = NULL,
  foldChangeLines = log2(1.5),
  refLineThickness = 1,
  legendPosition = "right",
  rugColor = NULL,
  rugAlpha = 1,
  baseFontSize = 12,
  themeStyle = "grey",
  footnote,
  footnoteSize = 3,
  footnoteColor = "black",
  footnoteJust = 1
)

Arguments

df

A dataframe with LogRatio and LogIntensity columns and optionally a pvalue or FDR column (typically a topTable dataframe).

logRatioCol

name of the LogRatio column (Default = "logFC")

logIntCol

name of the LogIntensity column (Default = "AveExpr")

pvalCol

name of the pvalue or FDR column (Default = "P.Value")

pthreshold

Used to color points (default = 0.01)

geneSymLabels

A character vector of gene to label (must be the name space of the column specified by geneSymCol)

geneSymCol

Name of the gene symbol column in df. The gene symbol is not in topTable output by default so the user has to bind this column to the dataframe in advance. Then this column will be used to label significantly changed points

xlab

X axis label (default the LogIntensity column name)

ylab

Y axis label (default the LogRatio column name)

title

Plot title (optional)

symbolSize

Size of symbols for Up, no change and Down. default = c(4, 3.99, 4); Note: you cannot choose the exact same size for all three. But you can use decimal values.

symbolShape

Shape of the symbols for Up, no change and Down; Default = c(21, 1, 21) (1 = open circle, 21 = fillable open circle); Note: you cannot choose the same symbol shape for all three. See http://www.cookbook-r.com/Graphs/Shapes_and_line_types

symbolColor

c(Up, NoChange, Down); default = c("black", "grey25", "grey0") See http://research.stowers-institute.org/efg/R/Color/Chart Note: You cannot duplicate colors.

symbolFill

Set the fill color for the symbols. Note only symbols 21-25 are fillable. This will have no effect on other symbols. Default = c("red3", "grey25", "deepskyblue4") Note: You cannot duplicate colors.

alpha

Controls the transparency of the plotted points (range: 0-1; default = 0.7)

pthresholdLine

Color for a horizontal line at the pthreshold (Default = NULL (disabled))

foldChangeLines

Position of reference vertical lines for fold change (Default = log2(1.5); NULL disables)

refLineThickness

Set the thickness for all reference lines (Default = 1)

legendPosition

One of "top", "bottom", "left", "right", "ne", "se", "nw", "sw", NULL. top/bottom/left/right place the legend outside the figure. ne/se/nw/sw place the figure inside the figure. NULL disables the legend. Default = "right"

rugColor

Specify color for rug density plot along xy axes. Set to NULL to disable rug layer. (Default=NULL)

rugAlpha

Sets the transparency for the rug layer. An alpha <1.0 takes a long time to draw (~10 min on 32bit Win7). So I set the default at 1.0, but for a final plot try 0.1 or 0.2 for alpha for a more informative rug.

baseFontSize

The smallest size font in the figure in points. Default = 12

themeStyle

"bw" or "grey" which correspond to theme_bw or theme_grey respectively. Default = bw"

footnote

optional string placed right justified at bottom of plot.

footnoteSize

applies to footnote. (default = 3)

footnoteColor

applies to footnote. (default = "black")

footnoteJust

Value 0-1. 0 is left justified, 1 is right justified, 0.5 is centered. (default=1)

scaleByIntensity

Set point size as a function of Intensity (Default = TRUE). Takes logIntCol and sets a floor and ceiling at 0 and 10, then uses this value to size the points.

Details

By default, the plot places "logFC" on the X axis and Log10 of the "P.Value" on the Y axis. By default, a reference vertical line is drawn at LogRatio = 0 on the X axis. Optionally, additional reference lines will be drawn at +/- a user supplied logratio threshold. The points are color coded using both the significance and fold-change thresholds supplied by the user. By default, the P.Value field is used with a threshold of 0.01 to color code the points and fold-change threshold of +/- 1.5X.

Data Structure for the input dataframe:

The defaults are set for dataframes produced by topTable and topTreat. The columns named "logFC" and "P.Value" are used by default to accommodate the column names used in topTable/topTreat dataframes. Any other dataframe can be used with foldchange, intensity and significance measures. In this case you must use the appropriate arguments to define the column names to use. By default, the column names will be used for the axis labels. You can overide the default xylabels the xlab and ylab arguments.

A significance measure (which defaults to P.Value <= 0.01) and LogRatio threshold are used to color code genes that are significantly increased or decreased. Use the appropriate arguments to use an FDR measure instead of pvalue.

Sensible defaults are chosen for symbols (Size, Shape, Color and Fill). Optionally, there are arguments to allow you to fiddle with these settings. A length of 3 is required for these arguments which applies the attributes in this order: Increased, NoChange, Decreased.

Value

ggplot object

Author(s)

John Thompson, john.thompson@bms.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
   Simple plot with custom title(df is a topTable dataframe)

   MyPlot = volcanoPlot(df, title = "Plot Title")

   Some options with a custom datafile

   MyPlot = volcanoPlot (df, pthreshold = 0.1,
     logRatioCol = "Log2ratio",
     logIntCol = "AverageIntensity",
     pvalCol = "BHFDR",
     xlab = "Log2 Ratio", ylab = "Log10 BHFDR",
     title = "Profile Plot Title",
     referenceLine = "blue",
     legendPosition="ne")

jrthompson54/DGE.Tools2 documentation built on May 12, 2021, 8:47 p.m.