Description Slot overview Constructor Supported methods Author(s) See Also Examples
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.
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 the first valid assay name (see ?".refineParameters,DotPlot-method"
for details).
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
.
The following slots control the values on the x-axis:
XAxis
, string specifying what should be plotting on the x-axis.
This can be any one of "None"
, "Sample name"
or "Column data"
.
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 addition, this class inherits all slots from its parent ColumnDotPlot, DotPlot and Panel classes.
SampleAssayPlot(...)
creates an instance of a SampleAssayPlot class, where any slot and its value can be passed to ...
as a named argument.
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 callNextMethod
.
For documentation:
.definePanelTour(x)
returns an data.frame containing a panel-specific tour.
Aaron Lun
ColumnDotPlot, for the immediate parent class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #################
# 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.