ColumnDataPlot-class: The ColumnDataPlot panel

ColumnDataPlot-classR Documentation

The ColumnDataPlot panel

Description

The ColumnDataPlot is a panel class for creating a ColumnDotPlot where the y-axis represents a variable from the colData 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 column data information that is used:

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

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

  • XAxisColumnData, string specifying the column of the colData to show on the x-axis. If NA, defaults to the first valid field.

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

Constructor

ColumnDataPlot(...) creates an instance of a ColumnDataPlot 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 ColumnDataPlot 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 XAxisColumnData with the name of the first valid colData variable. This will also call the equivalent ColumnDotPlot method for further refinements to x. If no valid column 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 colData(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 colData(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 ColumnDotPlot method.

For controlling selections:

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

For defining the panel name:

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

For creating the plot:

  • .generateDotPlotData(x, envir) will create a data.frame of column 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

ColumnDotPlot, for the immediate parent class.

Examples

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

x <- ColumnDataPlot()
x[["XAxis"]]
x[["XAxis"]] <- "Column data"

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

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

old_cd <- colData(sce)
colData(sce) <- NULL

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

# Replaces the default with something sensible.
colData(sce) <- old_cd
sce0 <- .cacheCommonInfo(x, sce)
.refineParameters(x, sce0)


iSEE/iSEE documentation built on April 5, 2024, 5:32 a.m.