VolcanoPlot-class: The VolcanoPlot class

VolcanoPlot-classR Documentation

The VolcanoPlot class

Description

The VolcanoPlot is a RowDataPlot subclass that is dedicated to creating a volcano plot. It retrieves the log-fold change and p-value from and creates a row-based plot where each point represents a feature.

Slot overview

The following slots control the thresholds used in the visualization:

  • PValueThreshold, a numeric scalar in (0, 1] specifying the threshold to use on the (adjusted) p-value. Defaults to 0.05.

  • LogFCThreshold, a non-negative numeric scalar specifying the threshold to use on the log-fold change. Defaults to 0.

  • PValueCorrection, a string specifying the multiple testing correction to apply. Defaults to "BH", but can take any value from p.adjust.methods.

In addition, this class inherits all slots from its parent RowDataPlot, RowDotPlot, DotPlot and Panel classes.

Constructor

VolcanoPlot(...) creates an instance of a VolcanoPlot class, where any slot and its value can be passed to ... as a named argument.

Users are expected to load relevant statistics into the rowData of a SummarizedExperiment. This panel expects one or more columns containing the p-values and log-fold changes for each gene/row - see Examples. The expected column names (and how to tune them) are listed at ?"registerPValueFields".

Supported methods

In the following code snippets, x is an instance of a RowDataPlot class. Refer to the documentation for each method for more details on the remaining arguments.

For setting up data values:

  • .cacheCommonInfo(x, se) returns se after being loaded with class-specific constants. This includes "valid.p.fields" and "valid.lfc.fields", character vectors containing the names of valid rowData columns for the p-values and log-fold changes, respectively.

  • .refineParameters(x, se) returns x after setting XAxis="Row data" and the various *Pattern fields to their cached values. This will also call the equivalent RowDataPlot method for further refinements to x. If valid p-value and log-fold change fields are not available, NULL is returned instead.

For defining the interface:

  • .defineDataInterface(x, se, select_info) returns a list of interface elements for manipulating all slots described above.

  • .panelColor(x) will return the specified default color for this panel class.

  • .allowableXAxisChoices(x, se) returns a character vector specifying the acceptable log-fold change-related variables in rowData(se) that can be used as choices for the x-axis.

  • .allowableYAxisChoices(x, se) returns a character vector specifying the acceptable p-value-related variables in rowData(se) that can be used as choices for the y-axis.

  • .hideInterface(x, field) will return TRUE for field="XAxis", otherwise it will call the RowDataPlot method.

  • .fullName(x) will return "Volcano plot".

For monitoring reactive expressions:

  • .createObservers(x, se, input, session, pObjects, rObjects) sets up observers for all new slots described above, as well as in the parent classes via the RowDataPlot method.

For creating the plot:

  • .generateDotPlotData(x, envir) will create a data.frame of row metadata variables in envir. This should contain negative log-transformed p-values on the y-axis and log-fold changes on the x-axis, in addition to an extra field specifying whether or not the feature was considered to be significantly up or down. The method will return the commands required to do so as well as a list of labels.

  • .prioritizeDotPlotData(x, envir) will create variables in envir marking the priority of points. Significant features receive higher priority (i.e., are plotted over their non-significant counterparts) and are less aggressively downsampled when Downsample=TRUE. The method will return the commands required to do this as well as a logical scalar indicating that rescaling of downsampling resolution is performed.

  • .colorByNoneDotPlotField(x) will return a string specifying the field of the data.frame (generated by .generateDotPlotData) containing the significance information. This is to be used for coloring when ColorBy="None".

  • .colorByNoneDotPlotScale(x) will return a string containing a ggplot2 command to add a default color scale when ColorBy="None".

  • .generateDotPlot(x, labels, envir) returns a list containing plot and commands, using the inital ColumnDataPlot ggplot and adding vertical lines demarcating the log-fold change threshold.

For documentation:

  • .definePanelTour(x) returns an data.frame containing the steps of a panel-specific tour.

  • .getDotPlotColorHelp(x, color_choices) returns a function that generates an rintrojs tour for the color choice UI.

Author(s)

Aaron Lun

See Also

RowDataPlot, for the base class.

Examples

# Making up some results:
se <- SummarizedExperiment(matrix(rnorm(10000), 1000, 10))
rownames(se) <- paste0("GENE_", seq_len(nrow(se)))
rowData(se)$PValue <- runif(nrow(se))
rowData(se)$LogFC <- rnorm(nrow(se))
rowData(se)$AveExpr <- rnorm(nrow(se))

if (interactive()) {
    iSEE(se, initial=list(VolcanoPlot()))
}


csoneson/iSEEu documentation built on Oct. 16, 2024, 4:50 a.m.