cdfPlot: Deluxe CDF Plots

Description Usage Arguments Details Value Author(s) Examples

View source: R/cdfPlot.R

Description

CDF plots are a good complement to pvalue histograms as a way to evaluate model performance and examine support for differential expression. Results are ranked by pvalue on the x-axis and the pvalue plotted on the y-axis. Since pvalue distributions should be flat, this type of plot should produce a straight line. Any observations that fail to meet the null hypothesis will appear as a break in the line at the low end of the curve.

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
cdfPlot(
  df,
  pvalCol = "P.Value",
  pthreshold = 0.01,
  xlab = NULL,
  ylab = NULL,
  title = NULL,
  insetTitle = NULL,
  symbolSize = c(2, 1),
  symbolShape = c(20, 20),
  symbolColor = c("red3", "deepskyblue4"),
  symbolFill = c("red3", "deepskyblue4"),
  alpha = 1,
  referenceLine = NULL,
  refLineThickness = 1,
  legendPosition = "se",
  baseFontSize = 12,
  viewportX = 0.15,
  viewportY = 0.93,
  viewportWidth = 0.35,
  themeStyle = "grey",
  pvalMax = 0.1,
  printPlot = TRUE,
  plotFile,
  footnote,
  footnoteSize = 3,
  footnoteColor = "black",
  footnoteJust = 1
)

Arguments

df

A dataframe with LogRatio and LogIntensity columns and optionally a pvalue or FDR column.

pvalCol

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

pthreshold

Used to color points (default = 0.01)

xlab

X axis label (default is "LogIntensity column name"Rank")

ylab

Y axis label (default is Pvalue column name)

title

Plot title (optional)

insetTitle

Title for the inset plot (Optional)

symbolSize

Size of symbols for Up, no change and Down. default = c(4, 1, 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, 20, 21) (20 = filled 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 (0-1; default = 0.5)

referenceLine

Color for an horizontal line drawn at the pthreshold (Default = NULL; NULL disables, set to desired color to enable)

refLineThickness

Set thicknesss of the reference line (Default=1)

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 = "grey"

pvalMax

Limit the range of the main plot (Default = 0.10)

printPlot

Specify printing the combined plot to the console/knitr (Default = TRUE)

plotFile

Provide a filename with .PNG extension to save the an image file. Font size doubled for PNG file output.

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)

Details

This function is designed to take topTable dataframes and display the corresponding CDF plot. Data for the pvalues below 0.1 (user settable via pvalMax argument) are show in a full size plot. An inset figure shows the whole pvalue scale and highlights the portion shown in the full plot. Points below 0.01 are a different color by default (threshold set by pthreshold argument; shape/color attributes customizable through arguments).

Two arguments control the output. printPlot = TRUE outputs the compound plot to the console/knitr. Provide a filename with a .PNG extension to save the compound plot to a PNG file. Font sizes are increase 1.5 fold for the PNG file. The default baseFontSize = 12 produces suitable output for knitr PDFs and the 1.5 fold adjustment produces a PNG file suitable for PPT presentations.

Data Structure for the input dataframe:

The defaults are set for dataframes produced by topTable. The column "P.Value" is used by default to accommodate the column names used in topTable dataframes. Any other dataframe can be used with by explicitly defining the pvalue column name with the appropriate argument.

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 2 is required for these arguments which applies the attributes in this order: Significant, Not Significant.

Value

A list containing mainplot, insetplot and viewport. You can then reconstruct the plot with: print(MyList$main); print(inset, vp=Mylist$viewport)

Author(s)

John Thompson, jrt@thompsonclan.org

Examples

1
2
3
   Plot to console and PNG file (df is a topTable dataframe)

   cdfPlot(df, title = "My CDF Plot", printFile = "MyCDFplot.PNG")

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