SampleAssayPlot-class: The SampleAssayPlot panel

SampleAssayPlot-classR Documentation

The SampleAssayPlot panel

Description

The SampleAssayPlot is a panel class for creating a RowDotPlot where the y-axis represents the expression of a sample of interest, using the assay values of the SummarizedExperiment. It provides slots and methods for specifying the sample and what to plot on the x-axis, as well as a method to actually create a data.frame containing those pieces of data in preparation for plotting.

Slot overview

The following slots control the values on the y-axis:

  • YAxisSampleName, a string specifying the name of the sample to plot on the y-axis. If NA, defaults to the first column name of the SummarizedExperiment object.

  • Assay, string specifying the name of the assay to use for obtaining expression values. Defaults to "logcounts" in getPanelDefault, falling back to the name of the first valid assay (see ?".cacheCommonInfo,DotPlot-method" for the definition of validity).

  • YAxisSampleSource, string specifying the encoded name of the transmitting panel to obtain a single selection that replaces YAxisSampleName. Defaults to "---", i.e., no transmission is performed.

  • YAxisSampleDynamicSource, a logical scalar indicating whether x should dynamically change its selection source for the y-axis. Defaults to FALSE in getPanelDefault.

The following slots control the values on the x-axis:

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

  • XAxisColumnData, string specifying which column of the colData should be shown on the x-axis, if XAxis="Column data". Defaults to the first valid colData field (see ?".refineParameters,ColumnDotPlot-method" for details).

  • XAaxisSampleName, string specifying the name of the sample to plot on the x-axis, if XAxis="Sample name". Defaults to the first column name.

  • XAxisSampleSource, string specifying the encoded name of the transmitting panel to obtain a single selection that replaces XAxisSampleName. Defaults to "---", i.e., no transmission is performed.

  • XAxisSampleDynamicSource, a logical scalar indicating whether x should dynamically change its selection source for the x-axis. Defaults to FALSE in getPanelDefault.

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

Constructor

SampleAssayPlot(...) creates an instance of a SampleAssayPlot 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 SampleAssayPlot class. Refer to the documentation for each method for more details on the remaining arguments.

For setting up data values:

  • .refineParameters(x, se) replaces any NA values in XAxisSampleName and YAxisSampleName with the first column name; any NA value in Assay with the first valid assay name; and any NA value in XAxisColumnData with the first valid column metadata field. This will also call the equivalent ColumnDotPlot method for further refinements to x. If no columns or assays are present, 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.

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 defining the panel name:

  • .fullName(x) will return "Sample assay plot".

For creating the plot:

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

For managing selections:

  • .singleSelectionSlots(x) will return a list specifying the slots that can be updated by single selections in transmitter panels, mostly related to the choice of sample on the x- and y-axes. This includes the output of the method for the parent RowDotPlot class.

  • .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 documentation:

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

Author(s)

Aaron Lun

See Also

ColumnDotPlot, for the immediate parent class.

Examples

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

x <- SampleAssayPlot()
x[["XAxis"]]
x[["Assay"]] <- "logcounts"
x[["XAxisRowData"]] <- "stuff"

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

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

old_assay_names <- assayNames(sce)
assayNames(sce) <- character(length(old_assay_names))

# Spits out a NULL and a warning if no assays are named.
sce0 <- .cacheCommonInfo(x, sce)
.refineParameters(x, sce0)

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


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