LogFCLogFCPlot-class: The LogFCLogFCPlot class

LogFCLogFCPlot-classR Documentation

The LogFCLogFCPlot class

Description

The LogFCLogFCPlot is a RowDataPlot subclass that is dedicated to creating a scatter plot of two log-fold changes. Each axis contains the log-fold change for a differential expression analysis and each point represents a feature.

Slot overview

The following slots control the thresholds used in the visualization:

  • XPValueField, a string specifying the field of rowData containing the p-values for the x-axis comparison.

  • YPValueField, a string specifying the field of rowData containing the p-values for the y-axis comparison.

  • 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

LogFCLogFCPlot(...) creates an instance of a LogFCLogFCPlot 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. There should be two columns for the p-values from each comparison - and another two for the corresponding 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" as well as "PValuePattern" and "LogFCPattern" to their corresponding 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 log-fold change-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 "LogFC-logFC 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 contains the two sets of log-fold changes on both axes, plus 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 horizontal 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)$PValue1 <- runif(nrow(se))
rowData(se)$LogFC1 <- rnorm(nrow(se))
rowData(se)$PValue2 <- runif(nrow(se))
rowData(se)$LogFC2 <- rnorm(nrow(se))

if (interactive()) {
    iSEE(se, initial=list(LogFCLogFCPlot(XAxisRowData="LogFC1", YAxis="LogFC2",
        XPValueField="PValue1", YPValueField="PValue2")))
}


iSEE/iSEEu documentation built on Oct. 11, 2024, 9:20 a.m.