volcanoPlot: generates a volcano plot of a data.frame with quantification...

View source: R/generalStat.R

volcanoPlotR Documentation

generates a volcano plot of a data.frame with quantification data & statisitcal significance data

Description

generates a volcano plot of a data.frame with quantification data & statisitcal significance data

Usage

volcanoPlot(
  data,
  quantColumn = 1,
  statColumn = 2,
  quantTransform = transformData("log2(data)"),
  statTransform = transformData("-log10(data)"),
  xLabel = ifelse(is.character(quantColumn), paste(c("Log2 ", quantColumn), collapse =
    ""), paste(c("Log2 ", colnames(data)[quantColumn]), collapse = "")),
  yLabel = ifelse(is.character(statColumn), paste(c("-Log10 ", statColumn), collapse =
    ""), paste(c("-Log10 ", colnames(data)[statColumn]), collapse = "")),
  xCutoffs = c(0.5, 2),
  yCutoff = 0.05,
  pointColor = "black",
  significantPointColor = "red",
  pointShape = 21,
  pointSize = 3,
  pointAlpha = 0.75,
  xDefault = TRUE,
  yDefault = TRUE,
  xLimits = c(0, NA),
  yLimits = c(0, NA),
  xExpand = ggplot2::expansion(mult = 0, add = 0),
  yExpand = ggplot2::expansion(mult = 0, add = 0),
  xSymmetric = FALSE,
  xSymmetricExpand = 0.05,
  xCentered = FALSE,
  xMedian = FALSE,
  xDeviations = 4,
  xLabelFormat = ggplot2::waiver(),
  yLabelFormat = ggplot2::waiver(),
  vertical = FALSE,
  title = "",
  gridLines = TRUE,
  volcanoLineMarkers = volcanoLineMarkerDedaults(),
  volcanoLineMarkerAttributes = volcanoMarkerAttributesDefaults(),
  returnData = FALSE,
  significanceColumnName = "",
  removeNonSignificantData = TRUE,
  identifierColumn = NA,
  ...
)

Arguments

data

data.frame with at least two columns

quantColumn

specifies which column in the data argument contains the quantification data (can be number or character vector)

statColumn

specifies which column in the data argument contains the statistical significance data (can be number or character vector). Usually these values are p-values from eg a t-test

quantTransform

specifies the function with which to transform the quantColumn data (if needed)

statTransform

specifies the function with which to transform the stattColumn data (if needed)

xLabel

defines x-axis label

yLabel

defines y-axis label

xCutoffs

minimum and maximum value of the quantColumn data (before transformation). Anything outside these values and lower than yCutoff will be marked as significant

yCutoff

minimum value of the statColumn data. any value lower is marked as significant (usually p-value < 0.05)

pointColor

defines the color of the border of the data points

significantPointColor

color of the data points that lie outside the xCutoff values and below the yCutoff value

pointShape

shape of the data points

pointSize

size of the data points

pointAlpha

alpha ('see through' value) of the data points

xDefault

default is set to TRUE, together with xLimits, this can be used to define the exact range of the X-axis

yDefault

default is set to TRUE, together with yLimits, this can be used to define the exact range of the Y-axis

xLimits

default = c(0,NA), together with xDefault, this can be used to define the exact range of the Y-axis

yLimits

default = c(0,NA), together with yDefault, this can be used to define the exact range of the Y-axis

xExpand

allows for padding around data (x-axis), see ?ggplot2::expansion for proper explanation

yExpand

allows for padding around data (y-axis), see ?ggplot2::expansion for proper explanation

xSymmetric

if TRUE then the range of x-axis will be adjusted to be equal on both the left and the right side of the center (transformed x = 0)

xSymmetricExpand

allows for padding around data (x-axis), 0.05 means 5 percent (pre-transformation) extra wide x-axis range

xCentered

if TRUE, the plot will be 'cemtered' around the either the mean or median x-value

xMedian

if TRUE then median and mean absolute deviation (mad) are used for centering the plot along the x-axis; if FALSE then the mean and tge standard deviation are used

xDeviations

defines how many deviations the range of the x-axis may differ from the mean or median. Range will be either (median-xDeviations*mad ,median+xDeviations**mad) or (mean - xDeviations*sd,mean + xDeviations*sd)

xLabelFormat

allows defining how the x-axis ticks etc are displayed (see formatDigits() & formatScientificDigits())

yLabelFormat

allows defining how the y-axis ticks etc are displayed (see formatDigits() & formatScientificDigits())

vertical

if TRUE then plot will be rotated 90 degrees

title

specifies the title

gridLines

if TRUE then gridlines are shown

volcanoLineMarkers

defines where to place marker lines in the plot

volcanoLineMarkerAttributes

defines the attributes of the marker lines

returnData

if TRUE then a list with 2 elements is returned. The first element is the data.frame used to generate the graph and the second element is the graph itself

significanceColumnName

name to give to the column specifying if a row is significant (TRUE) or (FALSE). If not specified, then the name "significant" will be used

removeNonSignificantData

if TRUE, no non-significant data will be returned (usually a smaller data.frame to return). If FALSE then all data will be returned

identifierColumn

specifies which columns from data (names -> character vector) should be included in the data.frame returned

...

can be used to pass on other arguments to graphAdjust()

Value

a ggplot object or a list

Note

quantColumn is the x-axis, the statColumn is the y-axis


BenBruyneel/BBPersonalR documentation built on Aug. 23, 2024, 8:28 p.m.