RowDataPlot-class: The RowDataPlot panel

RowDataPlot-classR Documentation

The RowDataPlot panel

Description

The RowDataPlot is a panel class for creating a RowDotPlot where the y-axis represents a variable from the rowData of a SummarizedExperiment object. It provides slots and methods for specifying which variable to use on the y-axis (and, optionally, also the x-axis), as well as a method to create the data.frame in preparation for plotting.

Slot overview

The following slots control the variables to be shown:

  • YAxis, a string specifying the row of the rowData to show on the y-axis. If NA, defaults to the first valid field (see ?".refineParameters,RowDotPlot-method").

  • XAxis, string specifying what should be plotting on the x-axis. This can be any one of "None", "Row data" and "Row selection". Defaults to "None".

  • XAxisRowData, string specifying the row of the rowData to show on the x-axis. If NA, defaults to the first valid field.

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

Constructor

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

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:

  • .refineParameters(x, se) returns x after replacing any NA value in YAxis or XAxisRowData with the name of the first valid rowData variable. This will also call the equivalent RowDotPlot method for further refinements to x. If no valid row metadata variables are 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 variables in rowData(se) that can be used as choices for the x-axis. This consists of all variables with atomic values.

  • .allowableYAxisChoices(x, se) returns a character vector specifying the acceptable variables in rowData(se) that can be used as choices for the y-axis. This consists of all variables with atomic values.

For monitoring reactive expressions:

  • .createObservers(x, se, input, session, pObjects, rObjects) sets up observers for all slots described above and in the parent classes. This will also call the equivalent RowDotPlot method.

For controlling selections:

  • .multiSelectionInvalidated(x) returns TRUE if the x-axis uses multiple row selections, such that the point coordinates may change upon updates to upstream selections in transmitting panels. Otherwise, it dispatches to the RowDotPlot method.

For defining the panel name:

  • .fullName(x) will return "Row data plot".

For creating the plot:

  • .generateDotPlotData(x, envir) will create a data.frame of row metadata variables in envir. It will return the commands required to do so as well as a list of labels.

For documentation:

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

Subclass expectations

Subclasses do not have to provide any methods, as this is a concrete class.

Author(s)

Aaron Lun

See Also

RowDotPlot, for the immediate parent class.

Examples

#################
# For end-users #
#################

x <- RowDataPlot()
x[["XAxis"]]
x[["XAxis"]] <- "Row data"

##################
# For developers #
##################

library(scater)
sce <- mockSCE()
sce <- logNormCounts(sce)

# Spits out a NULL and a warning if is nothing to plot.
sce0 <- .cacheCommonInfo(x, sce)
.refineParameters(x, sce0)

# Replaces the default with something sensible.
rowData(sce)$Stuff <- runif(nrow(sce))
sce0 <- .cacheCommonInfo(x, sce)
.refineParameters(x, sce0)


csoneson/iSEE documentation built on Dec. 13, 2024, 6:14 a.m.