The MAPlot is a RowDataPlot subclass that is dedicated to creating a MA plot. It retrieves the log-fold change and average abundance and creates a row-based plot where each point represents a feature.
Slot overview
The following slots control the thresholds used in the visualization:
PValueField, a string specifying the field ofrowDatacontaining the p-values.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 fromp.adjust.methods.
In addition, this class inherits all slots from its parent RowDataPlot, RowDotPlot, DotPlot and Panel classes.
Constructor
MAPlot(...) creates an instance of a MAPlot 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, log-fold changes and average abundances 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)returnsseafter being loaded with class-specific constants. This includes"valid.p.fields","valid.ab.fields"and"valid.lfc.fields", which are character vectors containing the names of validrowDatacolumns for the p-values, average abundances and log-fold changes, respectively..refineParameters(x, se)returnsxafter settingXAxis="Row data"and the various*Patternfields to their cached values. This will also call the equivalent RowDataPlot method for further refinements tox. If valid p-value, abundance and log-fold change fields are not available,NULLis 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 average abundance-related variables inrowData(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 inrowData(se)that can be used as choices for the y-axis..hideInterface(x, field)will returnTRUEforfield="XAxis", otherwise it will call the RowDataPlot method..fullName(x)will return"MA 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 inenvir. This should contain average abundances on the x-axis and log-fold changes on the y-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 inenvirmarking the priority of points. Significant features receive higher priority (i.e., are plotted over their non-significant counterparts) and are less aggressively downsampled whenDownsample=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 whenColorBy="None"..colorByNoneDotPlotScale(x)will return a string containing a ggplot2 command to add a default color scale whenColorBy="None"..generateDotPlot(x, labels, envir)returns a list containingplotandcommands, 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.
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(MAPlot()))
}